costin      2003/03/11 22:04:31

  Modified:    catalina/src/share/org/apache/catalina/core
                        ContainerBase.java
  Log:
  Forgive duplicated start() calls. Nobody is hurt
  
  Revision  Changes    Path
  1.8       +25 -6     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ContainerBase.java
  
  Index: ContainerBase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ContainerBase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ContainerBase.java        16 Feb 2003 19:44:47 -0000      1.7
  +++ ContainerBase.java        12 Mar 2003 06:04:31 -0000      1.8
  @@ -93,8 +93,10 @@
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
   import org.apache.catalina.Valve;
  +import org.apache.catalina.valves.ValveBase;
   import org.apache.catalina.util.LifecycleSupport;
   import org.apache.catalina.util.StringManager;
  +import org.apache.commons.modeler.Registry;
   
   
   /**
  @@ -1189,9 +1191,10 @@
       public synchronized void start() throws LifecycleException {
   
           // Validate and update our current component state
  -        if (started)
  -            throw new LifecycleException
  -                (sm.getString("containerBase.alreadyStarted", logName()));
  +        if (started) {
  +            log.info(sm.getString("containerBase.alreadyStarted", logName()));
  +            return;
  +        }
   
           // Notify our interested LifecycleListeners
           lifecycle.fireLifecycleEvent(BEFORE_START_EVENT, null);
  @@ -1330,11 +1333,19 @@
       public synchronized void addValve(Valve valve) {
   
           pipeline.addValve(valve);
  +        // If we are registered and the valve is not - create a default name
  +//        if( domain != null && valve instanceof ValveBase &&
  +//                ((ValveBase)valve).getObjectName()==null ) {
  +//            try {
  +//                ObjectName oname=((ValveBase)valve).createObjectName(domain, 
this.getObjectName());
  +//                Registry.getRegistry().registerComponent(valve, oname, 
valve.getClass().getName());
  +//            } catch( Throwable t ) {
  +//                log.info( "Can't register valve " + valve , t );
  +//            }
  +//        }
           fireContainerEvent(ADD_VALVE_EVENT, valve);
  -
       }
   
  -
       /**
        * <p>Return the Valve instance that has been distinguished as the basic
        * Valve for this Pipeline (if any).
  @@ -1367,6 +1378,14 @@
       public synchronized void removeValve(Valve valve) {
   
           pipeline.removeValve(valve);
  +//        if( domain != null && valve instanceof ValveBase ) {
  +//            try {
  +//                ObjectName oname=((ValveBase)valve).getObjectName();
  +//                Registry.getRegistry().getMBeanServer().unregisterMBean(oname);
  +//            } catch( Throwable t ) {
  +//                log.info( "Can't unregister valve " + valve , t );
  +//            }
  +//        }
           fireContainerEvent(REMOVE_VALVE_EVENT, valve);
   
       }
  
  
  

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

Reply via email to