tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cox, Charlie" <c...@cincom.com>
Subject RE: static,synchronized and classloaders
Date Wed, 13 Jun 2001 15:49:33 GMT
well, I am using TC 3.2.1(win2k,standalone and w/iis, with and without
virtual hosts), but it seems to work the same.

Also make sure your jar is not in tomcat\lib or your classpath

thanks for the thorough test Bo
Charlie

> -----Original Message-----
> From: Bo Xu [mailto:bo@cybershop.ca]
> Sent: Wednesday, June 13, 2001 11:10 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Re: static,synchronized and classloaders
> 
> 
> Hi :-)  I did a test with TC4.0-b5(standalone, J2SE1.3, winnt40):
> 
> * cases:
> -
>    % put the Same MyServlet.class in WEB-INF/classes in
>        Different "Context path" which has Different "Context docBase"
>    % put the Same MyServlet.class in the Same MyJar.jar file in
> WEB-INF/lib in
>        Different "Context path" which has Different "Context docBase"
> 
>    % put the Same MyUtility.class in WEB-INF/classes in
>        Different "Context path" which has Different "Context docBase"
>    % put the Same MyUtility.class in the Same MyJar.jar file in
> WEB-INF/lib in
>        Different "Context path" which has Different "Context docBase"
> 
> -
>    % put the Same MyServlet.class in WEB-INF/classes in
>        Different "Context path" which has Same "Context docBase"
>    % put the Same MyServlet.class in the Same MyJar.jar file in
> WEB-INF/lib in
>        Different "Context path" which has Same "Context docBase"
> 
>    % put the Same MyUtility.class in WEB-INF/classes in
>        Different "Context path" which has Same "Context docBase"
>    % put the Same MyUtility.class in the Same MyJar.jar file in
> WEB-INF/lib in
>        Different "Context path" which has Same "Context docBase"
> 
> * in all the above cases, all MyServlet/MyUtility of different
>    "Context path"(NOT "Context docBase") are different in the
>     follwing way:
>       - classloader:     this.getClass().getClassLoader().hashCode()
>       - Class object:   this.getClass().hashCode()
>       (so/then), I can seprate all the "public static field" in
> MyServlet/MyUtility by
>       different "Context path"(NOT "Context docBase"), i.e. :
>        % I can set "it is 0" to a "public static String 
> field"->MyField
> in MyServlet/MyUtility
>           of "Context path0", and use it within "Context path0"
>        % I can set "it is 1" to a "public static String 
> field"->MyField
> in MyServlet/MyUtility
>           of "Context path1", and use it within "Context path1"
>        - i.e.,  "Context path"/webappClassLoader/"Class 
> object"/"static
> field"
>           is "independent" to the following:
>             %  "Context docBase"
>             %  .class file/.jar file
> 
> and please notice that jar file in WEB-INF/lib can not be 
> auto-reloaded,
> so if you
> update a jar file in WEB-INF/lib,  you need to re-start TC4.0-b5.
> 
> 
> Bo
> June 13, 2001
> 
> 
> 
> 

Mime
View raw message