tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r603074 - /tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
Date Mon, 10 Dec 2007 22:24:41 GMT
Author: markt
Date: Mon Dec 10 14:24:40 2007
New Revision: 603074

URL: http://svn.apache.org/viewvc?rev=603074&view=rev
Log:
Fix bug 44041. A small sync is required to prevent attempts to load the same class twice.

Modified:
    tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java

Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=603074&r1=603073&r2=603074&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Mon Dec 10 14:24:40
2007
@@ -167,6 +167,11 @@
      */
     boolean antiJARLocking = false; 
     
+    /**
+     * Lock to prevent attempts to load duplicate classes from external
+     * repositories.
+     */
+    private Object lock = new Object();
 
     // ----------------------------------------------------------- Constructors
 
@@ -883,7 +888,9 @@
             }
             if ((clazz == null) && hasExternalRepositories) {
                 try {
-                    clazz = super.findClass(name);
+                    synchronized (lock) {
+                        clazz = super.findClass(name);
+                    }
                 } catch(AccessControlException ace) {
                     throw new ClassNotFoundException(name, ace);
                 } catch (RuntimeException e) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message