costin      2002/08/22 10:19:48

  Modified:    src/main/org/apache/tools/ant Tag: ANT_15_BRANCH
                        AntClassLoader.java
  Log:
  Backport the 'synchronized' fix.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.52.2.4  +4 -1      
jakarta-ant/src/main/org/apache/tools/ant/AntClassLoader.java
  
  Index: AntClassLoader.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/AntClassLoader.java,v
  retrieving revision 1.52.2.3
  retrieving revision 1.52.2.4
  diff -u -r1.52.2.3 -r1.52.2.4
  --- AntClassLoader.java       17 Jun 2002 05:44:54 -0000      1.52.2.3
  +++ AntClassLoader.java       22 Aug 2002 17:19:47 -0000      1.52.2.4
  @@ -906,8 +906,11 @@
        * on the system classpath (when not in isolated mode) or this loader's
        * classpath.
        */
  -    protected Class loadClass(String classname, boolean resolve)
  +    protected synchronized Class loadClass(String classname, boolean resolve)
            throws ClassNotFoundException {
  +        // 'sync' is needed - otherwise 2 threads can load the same class
  +        // twice, resulting in LinkageError: duplicated class definition.
  +        // findLoadedClass avoids that, but without sync it won't work.
   
           Class theClass = findLoadedClass(classname);
           if (theClass != null) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to