You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2002/08/09 12:01:49 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader WebappClassLoader.java

remm        2002/08/09 03:01:48

  Modified:    catalina/src/share/org/apache/catalina/loader
                        WebappClassLoader.java
  Log:
  - Attempt to fix 11307. Please test, there could be regressions and thread safety
    problems, and I have no way to properly test this.
  - Sync on the CL itself instead of the ResourceEntry, which caused problems
    because of locking which could occur in the superclass.
  - Thanks to Scott Ganyo <apache at ganyo.com> for the report and the
    explanation.
  
  Revision  Changes    Path
  1.45      +16 -14    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java
  
  Index: WebappClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/WebappClassLoader.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- WebappClassLoader.java	6 Aug 2002 00:16:59 -0000	1.44
  +++ WebappClassLoader.java	9 Aug 2002 10:01:48 -0000	1.45
  @@ -1654,18 +1654,20 @@
   
           }
   
  -        synchronized (entry) {
  -            // Since all threads use the same ResourceEntry instance, it is
  -            // the one which will contain the class
  -            if (entry.loadedClass == null) {
  -                clazz = defineClass(name, entry.binaryContent, 0,
  -                                    entry.binaryContent.length, codeSource);
  -                entry.loadedClass = clazz;
  -            } else {
  -                clazz = entry.loadedClass;
  +        if (entry.loadedClass == null) {
  +            synchronized (this) {
  +                if (entry.loadedClass == null) {
  +                    clazz = defineClass(name, entry.binaryContent, 0,
  +                                        entry.binaryContent.length, 
  +                                        codeSource);
  +                    entry.loadedClass = clazz;
  +                } else {
  +                    clazz = entry.loadedClass;
  +                }
               }
  +        } else {
  +            clazz = entry.loadedClass;
           }
  -
   
           return clazz;
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>