remm        2003/06/15 00:09:10

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardContext.java
  Log:
  - The context needs to be registered in JMX before starting the pipeline.
    Otherwise, the valves will not get unregistered properly when undeploying.
  - I hope this does not cause other problems, but a fix was clearly needed.
  
  Revision  Changes    Path
  1.64      +29 -7     
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.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- StandardContext.java      29 May 2003 04:13:24 -0000      1.63
  +++ StandardContext.java      15 Jun 2003 07:09:10 -0000      1.64
  @@ -3867,7 +3867,7 @@
   
           // Set config file name
           String appBase = getAppBase();
  -        if (getConfigFile() == null && appBase != null) {
  +        if ((getConfigFile() == null) && (appBase != null)) {
   
               String name = getName();
               if (name.equals("")) {
  @@ -4020,6 +4020,9 @@
                   // Initialize associated mapper
                   mapper.setContext(getPath(), welcomeFiles, resources);
   
  +                // JMX registration
  +                registerJMX();
  +
                   // Start our child containers, if any
                   Container children[] = findChildren();
                   for (int i = 0; i < children.length; i++) {
  @@ -4128,12 +4131,20 @@
               }
               setAvailable(false);
           }
  -        registerJMX();
  +
  +        // Wrappers JMX registration
  +        registerWrappersJMX();
   
           // Notify our interested LifecycleListeners
           lifecycle.fireLifecycleEvent(AFTER_START_EVENT, null);
           startTime=System.currentTimeMillis();
  -        
  +
  +        // Close all JARs right away to avoid always opening a peak number 
  +        // of files on startup
  +        if (getLoader() instanceof WebappLoader) {
  +            ((WebappLoader) getLoader()).closeJARs(true);
  +        }
  +
           //cacheContext();
       }
       
  @@ -4363,10 +4374,13 @@
               ((StandardManager) getManager()).processExpires();
           }
   
  -        if (reloadable && (getLoader() != null)) {
  -            if (getLoader().modified()) {
  +        if (getLoader() != null) {
  +            if (reloadable && (getLoader().modified())) {
                   reload();
               }
  +            if (getLoader() instanceof WebappLoader) {
  +                ((WebappLoader) getLoader()).closeJARs(false);
  +            }
           }
   
       }
  @@ -5007,13 +5021,21 @@
                       Registry.getRegistry().registerComponent(this,oname, null);
                   }
               }
  +        } catch( Exception ex ) {
  +            log.info("Error registering ctx with jmx " + this + " " +
  +                    oname + " " + ex.toString(), ex );
  +        }
  +    }
  +
  +    private void registerWrappersJMX() {
  +        try {
               for( Iterator it=wrappers.iterator(); it.hasNext() ; ) {
                   StandardWrapper wrapper=(StandardWrapper)it.next();
                   // XXX prevent duplicated registration
                   wrapper.registerJMX( this );
               }
           } catch( Exception ex ) {
  -            log.info("Error registering ctx with jmx " + this + " " +
  +            log.info("Error registering wrapper with jmx " + this + " " +
                       oname + " " + ex.toString(), ex );
           }
       }
  
  
  

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

Reply via email to