Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 329048 - SDO: User-set ApplicationResolver is not being utilized if the WLS ExecuteThread is null
Summary: SDO: User-set ApplicationResolver is not being utilized if the WLS ExecuteTh...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-29 09:45 EDT by David McCann CLA
Modified: 2022-06-09 10:31 EDT (History)
0 users

See Also:


Attachments
Proposed code changes for the 2.1.2 stream (2.47 KB, patch)
2010-10-29 10:52 EDT, David McCann CLA
no flags Details | Diff
Proposed code changes for the 2.2 stream (2.47 KB, patch)
2010-10-29 10:52 EDT, David McCann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David McCann CLA 2010-10-29 09:45:24 EDT
In the case where the current thread is non-wls managed the ExecuteThread is null.  Since our code only uses the ApplicationResolver when ExecuteThread doesn't return the app name, we never use the resolver if the ExecuteThread is null.  We need to use the ApplicationResolver if ExecuteThread is null, or the returned application name is null.
Comment 1 David McCann CLA 2010-10-29 09:47:23 EDT
The code that looks up the WLS application name should be changed as follows:

// Helper contexts in WebLogic server will be keyed on application 
// name if available
if (classLoaderName.contains(WLS_CLASSLOADER_NAME)) {
  Object appName = null;
  Object executeThread = getExecuteThread();
  if (executeThread != null) {
    try {
      Method getMethod = 
        PrivilegedAccessHelper.getPublicMethod(executeThread.getClass(), 
        WLS_APPLICATION_NAME_GET_METHOD_NAME, WLS_PARAMETER_TYPES, false);
      appName = PrivilegedAccessHelper.invokeMethod(getMethod, executeThread);
    } catch (Exception e) {
      throw SDOException.errorInvokingWLSMethodReflectively(
        WLS_APPLICATION_NAME_GET_METHOD_NAME, WLS_EXECUTE_THREAD, e);
    }
  }
  // if ExecuteThread is null or doesn't return the app name, attempt 
  // to use the user-set ApplicationResolver (if set)
  if (appName == null && appResolver != null) {
    appName = appResolver.getApplicationName();
  }
  // use the application name if set, otherwise key on the class loader
  if (appName != null) {
    return new MapKeyLookupResult(appName.toString(), classLoader);
  } 
  // couldn't get the application name, so default to the context loader
  return new MapKeyLookupResult(classLoader);
}
Comment 2 David McCann CLA 2010-10-29 10:52:00 EDT
Created attachment 182049 [details]
Proposed code changes for the 2.1.2 stream
Comment 3 David McCann CLA 2010-10-29 10:52:14 EDT
Created attachment 182050 [details]
Proposed code changes for the 2.2 stream
Comment 4 David McCann CLA 2010-11-01 10:34:55 EDT
Reviewed by:  blaise.doughan@oracle.com; matt.macivor@oracle.com
Tests:  all unit tests pass as expected

2.1.2 rev 8448
2.2 rev 8449
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:31:36 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink