billbarker    2002/08/20 21:08:43

  Modified:    src/share/org/apache/tomcat/modules/config
                        LoaderInterceptor11.java
  Log:
  Session reloading support on Context reload.
  
  Revision  Changes    Path
  1.25      +23 -5     
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LoaderInterceptor11.java
  
  Index: LoaderInterceptor11.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LoaderInterceptor11.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- LoaderInterceptor11.java  11 Jan 2002 07:01:24 -0000      1.24
  +++ LoaderInterceptor11.java  21 Aug 2002 04:08:43 -0000      1.25
  @@ -96,6 +96,7 @@
       Vector additionalJars=new Vector();
       String additionalJarsS=null;
       String jarSeparator=":";
  +    static final String clAttribute = "org.apache.tomcat.classloader";
       
       public LoaderInterceptor11() {
       }
  @@ -230,13 +231,30 @@
   
       }
   
  +    /** setup the ClassLoader for this context.
  +     *  If this is a re-loaded context, do nothing.
  +     */
       public void contextInit( Context ctx )
        throws TomcatException
       {
        // jsp will add it's own stuff
  -     prepareClassLoader( ctx );
  +     if(ctx.getAttribute(clAttribute) == null) {
  +         prepareClassLoader( ctx );
  +     }
       }
  -    
  +
  +    public void copyContext(Request req, Context oldC, Context newC)
  +     throws TomcatException {
  +     if(debug > 0)
  +         log( "Reload event " + newC.getPath() );
  +     // construct a new loader
  +     ClassLoader oldLoader=oldC.getClassLoader();
  +
  +     // will be used by reloader or other modules to try to
  +     // migrate the data. 
  +     newC.getContainer().setNote( "oldLoader", oldLoader);
  +    }
  +
       /** Construct another class loader, when the context is reloaded.
        */
       public void reload( Request req, Context context) throws TomcatException {
  @@ -259,7 +277,7 @@
           }
   
        context.setClassLoader( loader );
  -     context.setAttribute( "org.apache.tomcat.classloader", loader);
  +     context.setAttribute( clAttribute, loader);
       }
   
       /** Initialize the class loader.
  @@ -309,7 +327,7 @@
        context.setClassLoader( loader );
   
        // support for jasper and other applications
  -     context.setAttribute( "org.apache.tomcat.classloader",loader);
  +     context.setAttribute(clAttribute, loader);
       }
       
       /** Override this method to provide an alternate loader
  @@ -405,7 +423,7 @@
            if (k.equals("org.apache.tomcat.jsp_classpath")) {
                return getClassPath(ctx);
            }
  -         if(k.equals("org.apache.tomcat.classloader")) {
  +         if(k.equals(clAttribute)) {
                return ctx.getClassLoader();
            }
   
  
  
  

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

Reply via email to