Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=44041
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 17 Aug 2009 22:20:29 +0000 (22:20 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 17 Aug 2009 22:20:29 +0000 (22:20 +0000)
Remove previous sync that didn't fix the issue
Make loadClass synchronized like java.lang.ClassLoader
I was concerned about possible performance implications but I saw no detectable change in start-up time with this change.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@805182 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/loader/WebappClassLoader.java

index 4f295f7..095859e 100644 (file)
@@ -900,9 +900,7 @@ public class WebappClassLoader
             }
             if ((clazz == null) && hasExternalRepositories) {
                 try {
-                    synchronized (this) {
-                        clazz = super.findClass(name);
-                    }
+                    clazz = super.findClass(name);
                 } catch(AccessControlException ace) {
                     throw new ClassNotFoundException(name, ace);
                 } catch (RuntimeException e) {
@@ -1259,7 +1257,7 @@ public class WebappClassLoader
      *
      * @exception ClassNotFoundException if the class was not found
      */
-    public Class<?> loadClass(String name, boolean resolve)
+    public synchronized Class<?> loadClass(String name, boolean resolve)
         throws ClassNotFoundException {
 
         if (log.isDebugEnabled())