tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <devli...@hanik.com>
Subject Re: svn commit: r603074 - /tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
Date Tue, 11 Dec 2007 00:53:35 GMT
if String objects are kept in a constants pool, then one would

                    synchronized (name) {
                        clazz = super.findClass(name);
                    }

to allow concurrent loading of different classes,

Filip

markt@apache.org wrote:
> 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
>
>
>
>   


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


Mime
View raw message