openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgras...@apache.org
Subject svn commit: r1160278 - in /openjpa/branches/1.0.x/openjpa-lib/src/main: java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java resources/org/apache/openjpa/lib/meta/localizer.properties
Date Mon, 22 Aug 2011 14:37:05 GMT
Author: jgrassel
Date: Mon Aug 22 14:37:04 2011
New Revision: 1160278

URL: http://svn.apache.org/viewvc?rev=1160278&view=rev
Log:
OPENJPA-1993: Deadlock Potential with XML ORM Processing

Modified:
    openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java
    openjpa/branches/1.0.x/openjpa-lib/src/main/resources/org/apache/openjpa/lib/meta/localizer.properties

Modified: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java?rev=1160278&r1=1160277&r2=1160278&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java
(original)
+++ openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/XMLMetaDataParser.java
Mon Aug 22 14:37:04 2011
@@ -361,14 +361,19 @@ public abstract class XMLMetaDataParser 
             _sourceName = sourceName;
             SAXParser parser = null;
             ClassLoader oldLoader = null;
-
+            ClassLoader overrideLoader = null;
+            
             try {
                 if (_overrideContextClassloader == true) {
-
                     oldLoader = (ClassLoader) AccessController.doPrivileged(
                         J2DoPrivHelper.getContextClassLoaderAction());
-                    AccessController.doPrivileged(J2DoPrivHelper.setContextClassLoaderAction(
-                        XMLMetaDataParser.class.getClassLoader()));
+                    
+                    overrideLoader = XMLMetaDataParser.class.getClassLoader();
+                    AccessController.doPrivileged(J2DoPrivHelper.setContextClassLoaderAction(overrideLoader));
              
+                    
+                    if (_log != null && _log.isTraceEnabled()) {
+                        _log.trace(_loc.get("override-contextclassloader-begin", oldLoader,
overrideLoader));
+                    }
                 }
 
                 parser = XMLFactory.getSAXParser(validating, true);
@@ -402,16 +407,18 @@ public abstract class XMLMetaDataParser 
                 JavaVersions.initCause(ioe, se);
                 throw ioe;
             } finally {
-                if (_overrideContextClassloader == true && oldLoader != null) {
+                if (_overrideContextClassloader == true) {
                     // Restore the old ContextClassloader
                     try {
+                        if (_log != null && _log.isTraceEnabled()) {
+                            _log.trace(_loc.get("override-contextclassloader-end", overrideLoader,
oldLoader));
+                        }
                         AccessController.doPrivileged(J2DoPrivHelper.setContextClassLoaderAction(oldLoader));
                     } catch (Throwable t) {
-                        if (_log != null && _log.isTraceEnabled()) {
-                            _log.trace(_loc.get("restore-contextclassloader-failed"));
+                        if (_log != null && _log.isWarnEnabled()) {
+                            _log.warn(_loc.get("restore-contextclassloader-failed"));
                         }
-                    }
-                    
+                    }           
                 }
             }
         } finally {

Modified: openjpa/branches/1.0.x/openjpa-lib/src/main/resources/org/apache/openjpa/lib/meta/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-lib/src/main/resources/org/apache/openjpa/lib/meta/localizer.properties?rev=1160278&r1=1160277&r2=1160278&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-lib/src/main/resources/org/apache/openjpa/lib/meta/localizer.properties
(original)
+++ openjpa/branches/1.0.x/openjpa-lib/src/main/resources/org/apache/openjpa/lib/meta/localizer.properties
Mon Aug 22 14:37:04 2011
@@ -25,6 +25,10 @@ cant-diff-elems: Unable to differentiate
 	elements for class arg parsing.  No element can be a complete prefix of \
 	another.
 class-arg: Error extracting class information from "{0}".
+override-contextclassloader-begin: Overriding thread context classloader \
+    from "{0}" to "{1}".
+override-contextclassloader-end: Restoring thread context classloader \
+    from "{0}" to "{1}".
 restore-contextclassloader-failed: An error occurred restoring the Thread's \
     context classloader.
 parse-error: An error was encountered while parsing element "{0}".  Make sure \



Mime
View raw message