title: OSGi feature uninstall works, but bundles are still installed
body: <p>EDIT: updated this question with latest information...</p>
  <p>I'm having issues running back-to-back &quot;features:uninstall&quot; commands for dependent features.  OSGi responds back with &quot;State change in progress...&quot;, but by accepting other requests, we run into issues.</p>
  <p>Strangely, this results in successful feature uninstalls, but unsuccessful bundle uninstalls.  We are addressing this by trying to order uninstall requests appropriately and adding a delay between steps, but I'm hoping for a more robust solution.</p>
  <p>As suggested, I also tried adding &quot;osgi:refresh&quot; in between steps...same behavior.  Is there another way to detect that &quot;Refresh Packages&quot; is still running to delay subsequent requests, etc?</p>
  <p>Here are the details...</p>
  <pre><code>karaf@root&gt; features:uninstall PolicyUtil  
  karaf@root&gt; features:uninstall Policy1  
  karaf@root&gt; features:uninstall Policy2    
  State change in progress for bundle &quot;file:/policy2.jar&quot; by thread &quot;Refresh Packages&quot;.  
  karaf@root&gt; features:uninstall Policy3  
  State change in progress for bundle &quot;file:/policy3.jar&quot; by thread &quot;Refresh Packages&quot;.  
  karaf@root&gt; features:uninstall Policy4  
  karaf@root&gt; features:uninstall Enabler1    
  State change in progress for bundle &quot;file:/enabler1.jar&quot; by thread &quot;Refresh Packages&quot;.    
  karaf@root&gt; features:uninstall Enabler2  
  State change in progress for bundle &quot;file:/enabler2.jar&quot; by thread &quot;Refresh Packages&quot;.  
  
  afterwards...we end up with features uninstalled (correct), but some bundles still installed (incorrect)
  
  osgi:list
  
  [ 277] [Installed  ] [            ] [       ] [   60] Policy2  
  [ 278] [Installed  ] [            ] [       ] [   60] Policy3  
  [ 280] [Installed  ] [            ] [       ] [   60] Enabler1  
  [ 281] [Installed  ] [            ] [       ] [   60] Enabler2  
  
  features:list
  
  [uninstalled] [1.0                 ] PolicyUtil                           repo-0  
  [uninstalled] [1.0                 ] Policy1                              repo-0  
  [uninstalled] [1.0                 ] Policy2                              repo-0  
  [uninstalled] [1.0                 ] Policy3                              repo-0  
  [uninstalled] [1.0                 ] Enabler1                             repo-0  
  [uninstalled] [1.0                 ] Enabler2                             repo-0  
  </code></pre>