Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 332738 - Refactor JPA Initialization code to facilitate redeployment in Gemini OSGi
Summary: Refactor JPA Initialization code to facilitate redeployment in Gemini OSGi
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-16 08:59 EST by Tom Ware CLA
Modified: 2022-06-09 10:26 EDT (History)
0 users

See Also:


Attachments
initial patch (65.40 KB, patch)
2010-12-16 09:01 EST, Tom Ware CLA
no flags Details | Diff
updated patch (49.11 KB, patch)
2010-12-17 14:35 EST, Andrei Ilitchev CLA
no flags Details | Diff
Fixes JavaSECMPInitializer to use initialPuInfos and emSetupImpls (857 bytes, patch)
2011-01-06 10:40 EST, Andrei Ilitchev CLA
no flags Details | Diff
Fix for OSGi and Performance regression in previous fix (2.2 stream) (1.78 KB, patch)
2011-01-07 09:53 EST, Tom Ware CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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