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

Bug 332738

Summary: Refactor JPA Initialization code to facilitate redeployment in Gemini OSGi
Product: z_Archived Reporter: Tom Ware <tom.ware>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
initial patch
none
updated patch
none
Fixes JavaSECMPInitializer to use initialPuInfos and emSetupImpls
none
Fix for OSGi and Performance regression in previous fix (2.2 stream) none

Description Tom Ware CLA 2010-12-16 08:59:36 EST
The current JPA Initialization code caches some of the constructs used for initialization in such a way as to potentially prevent redployment in Gemini and potentially cause memory leaks due to the fact that the inherited code assumes a Java SE-type deployment.

We should clean-up the access to the static variables help by our deployment process such as the initial set of emSetupImpls and persistenceUnit infos.

This clean-up will require changes to our legacy OSGi code to keep it working.
Comment 1 Tom Ware CLA 2010-12-16 09:01:34 EST
Created attachment 185314 [details]
initial patch
Comment 2 Andrei Ilitchev CLA 2010-12-17 14:35:12 EST
Created attachment 185453 [details]
updated patch

The patch keeps all OSGi changes made in the initial patch.
- back to singleton JavaSECMPInitializer - in agent case;
- otherwise each getInitializer creates a new entity of JavaSECMPInitializer;
- initialPuInfos and initialEmSetupImpls are kept on the initializer if keepAllPredeployedPersistenceUnits method returns true - currently should happen only for JavaSECMPInitializer with agent;
- buried classloader in initializer so that they don't surface in PersistenceProvider code;
- SEPersistenceInfo now created with both main and temp class loaders set to the initializationClassloader if the creating Initializer.
- changed PersistenceUnit.getInitializer method to take puName and properties;
- removed from PersistenceUnit the version of createEMF method that took class loader.
Comment 3 Tom Ware CLA 2010-12-20 13:48:29 EST
Checked in changes.

Collectively developed and reviewed by Andrei Ilitchev and Tom Ware

Tested with JPA and Core LRG and also with Gemini JPA tests along with change made for the cooresponding Gemini Bug 332743.
Comment 4 Andrei Ilitchev CLA 2011-01-06 10:40:25 EST
Created attachment 186178 [details]
Fixes JavaSECMPInitializer to use initialPuInfos and emSetupImpls

Fixes a problem introduced by the original patch - it completely switched off the usage of initialPuInfos and initialEmSetupImpls.
That happened because keepAllPredeployedPersistenceUnits method was forgotten in JavaSECMPInitializer:
JPAInitializer doesn't keep initials, but SE does in case the agent is used.
Comment 5 Tom Ware CLA 2011-01-07 09:53:42 EST
Created attachment 186275 [details]
Fix for OSGi and Performance regression in previous fix (2.2 stream)
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:26:45 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink