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

Bug 318215

Summary: SDO: HelperContext lookup issues with non-WLS owned thread
Product: z_Archived Reporter: David McCann <david.mccann>
Component: EclipselinkAssignee: David McCann <david.mccann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix for 2.1.1
none
Proposed fix for 2.0 none

Description David McCann CLA 2010-06-28 13:12:44 EDT
The is a scenario in which the first lookup occurs in a WLS owned thread, where we get the app name and use that as the key.  Later on the lookup is performed in a non-WLS owned thread, so we cannot get the app name...  the loaders, however, are the same so we can lookup based on it.  In the equals method of HelperContexMapKey we need to check for application name equality as well as class loader equality, i.e.:

...
// if the applicationName is non-null we will base equality on it
if (applicationName != null) {
  return this.applicationName.equals(ckey.getApplicationName()) 
  || areLoadersEqual(ckey.getLoader());
}
// at this point we have to assume that the class loader is the map key, so base equality on it
return areLoadersEqual(ckey.getLoader());
...

We will also need to make the hashCode method return a consistent value NOT based on app name or class loader.
Comment 1 David McCann CLA 2010-06-28 13:20:55 EDT
Created attachment 172931 [details]
Proposed fix for 2.1.1
Comment 2 David McCann CLA 2010-06-28 13:25:55 EDT
Created attachment 172932 [details]
Proposed fix for 2.0
Comment 3 David McCann CLA 2010-06-28 13:35:15 EDT
Reviewed by: matt.macivor@oracle.com
Tests:  all unit tests pass as expected; all server tests pass as expected

Fix checked into 2.1.1 and 2.2

NOTE:  patch file 'Proposed fix for 2.0' should be named 'Proposed fix for 2.2'
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:06:10 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink