title: How does OSGi bundle update work?
body: <p>When a bundle is updated (say to fix a bug), what happens to other bundles that are currently using the one being updated?</p>
  
  <p>Say that there are two bundles service and dao. Say that classes in service bundle are using classes in dao bundle when I issue command to update dao layer. Will the class in service layer using dao code get an exception? </p>
  
  <hr>
  
  <p>Thanks for your <a href="https://stackoverflow.com/a/4335798">response</a>. </p>
  
  <p>I meant to say updated with the same version. </p>
  
  <blockquote>
    <p>until a bundle refresh occurs which includes the dependent bundle.</p>
  </blockquote>
  
  <p>Bundle refresh operation is invoked by the user updating the bundle, right? Say that when user invokes refresh to update dao bundle, a class in bundle service invoked a method on a class in dao layer... what happens in this scenario?</p>
  
  <p>I found this blog post helpful:
  <a href="http://solutionsfit.com/blog/2008/08/27/osgi-what-modularity-can-do-for-you-part-1/" rel="noreferrer">http://solutionsfit.com/blog/2008/08/27/osgi-what-modularity-can-do-for-you-part-1/</a></p>
  
  <p>From the post:</p>
  
  <blockquote>
    <p>If we simply replace the bundle with a bundle that includes the fix, the container will unregister the old bundle and register the new bundle. The proxy can then handle the reference shuffling and resume the service invocation.  This interaction will be almost instantaneous. Your customers will be completely oblivious to what has happened and you just saved your company a substantial amount of money (do I hear bonus?).</p>
  </blockquote>
  
  <p>In this blog post, the call to authorizePayment() was put on hold until the updated bundle is available. What happens if the control is within the authorizePayment() method when bundle refresh happens?</p>