remm        2003/09/09 08:27:00

  Modified:    catalina/src/share/org/apache/catalina Cluster.java
               catalina/src/share/org/apache/catalina/core
                        StandardContext.java
               catalina/src/share/org/apache/catalina/session
                        StandardManager.java
               catalina/src/share/org/apache/catalina/startup
                        ContextConfig.java
  Log:
  - Refactor manager initialization, and move it into ContextConfig.
  - Remove Cluster.setDistributable.
  
  Revision  Changes    Path
  1.5       +5 -12     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Cluster.java
  
  Index: Cluster.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Cluster.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Cluster.java      16 Apr 2003 04:06:53 -0000      1.4
  +++ Cluster.java      9 Sep 2003 15:27:00 -0000       1.5
  @@ -221,13 +221,6 @@
        *  the web application
        */
       public void stop(String contextPath) throws IOException;
  -    
  -    /**
  -     * Notifies the cluster if a context is distributable or not
  -     * @param contextName - the name of the registed context
  -     * @param distributable - true means that the sessions will be replicated
  -     */
  -    public void setDistributable(String contextName, boolean distributable);
  -    
  +
   
   }
  
  
  
  1.90      +8 -31     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- StandardContext.java      8 Sep 2003 15:25:18 -0000       1.89
  +++ StandardContext.java      9 Sep 2003 15:27:00 -0000       1.90
  @@ -964,12 +964,9 @@
       public void setDistributable(boolean distributable) {
           boolean oldDistributable = this.distributable;
           this.distributable = distributable;
  -        if ( getCluster() != null ) 
getCluster().setDistributable(getName(),distributable);
           support.firePropertyChange("distributable",
                                      new Boolean(oldDistributable),
                                      new Boolean(this.distributable));
  -        
  -
       }
   
   
  @@ -3923,7 +3920,7 @@
               }
           }
           
  -        if (getLoader() == null) {      // (2) Required by Manager
  +        if (getLoader() == null) {
               if (getPrivileged()) {
                   if (log.isDebugEnabled())
                       log.debug("Configuring privileged default Loader");
  @@ -3934,28 +3931,6 @@
                   setLoader(new WebappLoader(getParentClassLoader()));
               }
           }
  -        if (getManager() == null) {     // (3) After prerequisites
  -            if (log.isDebugEnabled())
  -                log.debug("Configuring default Manager");
  -            if (getCluster() != null) {
  -                try {
  -//                    The setDistributable is set after the context is started, 
hence 
  -//                    this doesn't work :(
  -//                    if ( this.getDistributable() ) {
  -                        log.debug("Creating clustering manager for 
context="+getName());
  -                        setManager(getCluster().createManager(getName()));
  -//                    } else {
  -//                        log.info("Ignoring clustering manager for 
context="+getName()+ " element <distributable> not present in web.xml");
  -//                        setManager(new StandardManager());    
  -//                    }
  -                } catch ( Exception x ) {
  -                    log.warn("Clustering disabled for context:"+getName()+" 
reason:"+x.getMessage());
  -                    setManager(new StandardManager());
  -                }
  -            } else {
  -                setManager(new StandardManager());
  -            }
  -        }
   
           // Initialize character set mapper
           getCharsetMapper();
  @@ -4045,8 +4020,10 @@
                   // Read tldListeners. XXX Option to disable
                   TldConfig tldConfig = new TldConfig();
                   tldConfig.setContext(this);
  -                tldConfig.setXmlValidation(((StandardHost) 
getParent()).getXmlValidation());
  -                tldConfig.setXmlNamespaceAware(((StandardHost) 
getParent()).getXmlNamespaceAware());
  +                tldConfig.setXmlValidation
  +                    (((StandardHost) getParent()).getXmlValidation());
  +                tldConfig.setXmlNamespaceAware
  +                    (((StandardHost) getParent()).getXmlNamespaceAware());
                   try {
                       tldConfig.execute();
                   } catch (Exception ex) {
  @@ -4058,10 +4035,10 @@
                   // Notify our interested LifecycleListeners
                   lifecycle.fireLifecycleEvent(START_EVENT, null);
   
  +                // Start manager
                   if ((manager != null) && (manager instanceof Lifecycle)) {
  -                    ((Lifecycle) manager).start();
  +                    ((Lifecycle) getManager()).start();
                   }
  -                    
   
               } finally {
                   // Unbinding thread
  
  
  
  1.14      +4 -5      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardManager.java
  
  Index: StandardManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/session/StandardManager.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StandardManager.java      26 Aug 2003 14:18:54 -0000      1.13
  +++ StandardManager.java      9 Sep 2003 15:27:00 -0000       1.14
  @@ -673,7 +673,6 @@
           
           // Validate and update our current component state
           if (started) {
  -            log.info(sm.getString("standardManager.alreadyStarted"));
               return;
           }
           lifecycle.fireLifecycleEvent(START_EVENT, null);
  
  
  
  1.33      +28 -1     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
  
  Index: ContextConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ContextConfig.java        2 Sep 2003 21:22:00 -0000       1.32
  +++ ContextConfig.java        9 Sep 2003 15:27:00 -0000       1.33
  @@ -92,6 +92,7 @@
   import org.apache.catalina.deploy.FilterMap;
   import org.apache.catalina.deploy.LoginConfig;
   import org.apache.catalina.deploy.SecurityConstraint;
  +import org.apache.catalina.session.StandardManager;
   import org.apache.catalina.util.SchemaResolver;
   import org.apache.catalina.util.StringManager;
   import org.apache.commons.digester.Digester;
  @@ -335,6 +336,28 @@
   
   
       /**
  +     * Set up a manager.
  +     */
  +    private synchronized void managerConfig() {
  +
  +        if (context.getManager() == null) {
  +            if ((context.getCluster() != null) && context.getDistributable()) {
  +                try {
  +                    context.setManager(context.getCluster().createManager
  +                                       (context.getName()));
  +                } catch (Exception ex) {
  +                    log.error("contextConfig.clusteringInit", ex);
  +                    ok = false;
  +                }
  +            } else {
  +                context.setManager(new StandardManager());
  +            }
  +        }
  +
  +    }
  +
  +
  +    /**
        * Set up an Authenticator automatically if required, and one has not
        * already been configured.
        */
  @@ -711,6 +734,10 @@
           // Configure an authenticator if we need one
           if (ok)
               authenticatorConfig();
  +
  +        // Configure a manager
  +        if (ok)
  +            managerConfig();
   
           // Dump the contents of this pipeline if requested
           if ((log.isDebugEnabled()) && (context instanceof ContainerBase)) {
  
  
  

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

Reply via email to