Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337157

Summary: Add an option to not refresh bundles that are already deployed
Product: [RT] Gemini.JPA Reporter: Michael Keith <michael.keith>
Component: CoreAssignee: Michael Keith <michael.keith>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eduard.bartsch, gunnar, jan.sievers, juergen.kissner, krum.tsvetkov, sabine.heider
Version: unspecified   
Target Milestone: 1.0.0 RC2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Michael Keith CLA 2011-02-14 14:41:19 EST
It might be worthwhile to add an option to not cause refreshing of persistence unit bundles found that were already deployed. This would cause them to be ignored, which probably is not what most people would want, but there seems to be an aversion (within some applications) to auto refreshing.
Comment 1 Krum Tsvetkov CLA 2011-02-25 06:39:35 EST
I was just going to open a similar bug and noticed this one.
We also experience some inconveniences by the refresh of the bundles. For example, when trying to execute a junit plugin test, which is using a persistence bundle we run into trouble. The persistence bundle gets restarted by the refresh, and then the dependent bundles (in this case the test bundle) also. JUnit doesn't always cope with this.

I know that in the dynamic OSGi world the different pieces should be coded to handle this kind of dynamics and should be able to cope with bundles/services coming and going. However, in practice this adds sometimes unneccessary complexity.

I started looking into the coding, trying to understand what the reason for the refresh packages is. I guess there may be no way around it. However, before I make my (possibly wrong) conclusions, can you shortly comment why it is neccessary? Why must the bundle go through the installing phase once more?

Thanks in advance!
Krum
Comment 2 Michael Keith CLA 2011-04-23 12:42:28 EDT
Sorry for the delay, I thought I explained this already, but it must have been in another bug.

The refresh is required because of weaving. For weaving to work, the classes cannot be loaded until the bundle is known to be a persistence bundle and processed by Gemini JPA. If the bundle happens to get started before Gemini JPA then classes may have been loaded and the only thing we can do is refresh it to cause it to go through the life cycle phases in order for Gemini JPA to detect it and plug in the weaving hooks.

The option to not refresh would allow applications to get started first, but would only work for applications that have weaving turned off or that do not cause any of the persistent managed classes to be loaded during activation.
Does this help?
Comment 3 Michael Keith CLA 2011-06-10 13:41:09 EDT
Added a REFRESH_BUNDLES system property to disable refreshing.

  e.g. on command line
    ...  -DREFRESH_BUNDLES=FALSE  ...

This option should ONLY be used when weaving is disabled.