costin      2003/04/04 14:21:35

  Modified:    coyote/src/java/org/apache/coyote/tomcat5
                        CoyoteConnector.java
  Log:
  Deal with the various registration orders.
  
  Revision  Changes    Path
  1.23      +26 -14    
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteConnector.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- CoyoteConnector.java      25 Mar 2003 17:47:46 -0000      1.22
  +++ CoyoteConnector.java      4 Apr 2003 22:21:35 -0000       1.23
  @@ -526,7 +526,10 @@
        * Connector.
        */
       public Container getContainer() {
  -
  +        if( container==null ) {
  +            // Lazy - maybe it was added later
  +            findContainer();     
  +        }
           return (container);
   
       }
  @@ -1078,7 +1081,6 @@
   
       }
   
  -
       /**
        * Initialize this connector (create ServerSocket here!)
        */
  @@ -1269,6 +1271,9 @@
   
           try {
               Registry.getRegistry().unregisterComponent(new 
ObjectName(domain,"type", "Mapper"));
  +            Registry.getRegistry().unregisterComponent(new ObjectName(domain
  +                    + ":type=protocolHandler,className="
  +                    + protocolHandlerClassName));
           } catch (MalformedObjectNameException e) {
               log.info( "Error unregistering mapper ", e);
           }
  @@ -1391,18 +1396,13 @@
               log.error( "Unregistering - can't stop", t);
           }
       }
  -
  -    public void init() throws Exception {
  -
  -        if( this.getService() != null ) {
  -            log.info( "Already configured" );
  -            return;
  -        }
  -        if( container==null ) {
  +    
  +    private void findContainer() {
  +        try {
               // Register to the service
               ObjectName parentName=new ObjectName( domain + ":" +
                       "type=Service");
  -
  +            
               log.info("Adding to " + parentName );
               if( mserver.isRegistered(parentName )) {
                   mserver.invoke(parentName, "addConnector", new Object[] { this },
  @@ -1418,16 +1418,28 @@
                   Object obj=mserver.getAttribute(engName, "managedResource");
                   log.info("Found engine " + obj + " " + obj.getClass());
                   container=(Container)obj;
  -
  +                
                   // Internal initialize - we now have the Engine
                   initialize();
  -
  +                
                   log.info("Initialized");
                   // As a side effect we'll get the container field set
                   // Also initialize will be called
                   return;
               }
  +        } catch( Exception ex ) {
  +            log.error( "Error finding container " + ex);
  +        }
  +    }
  +
  +    public void init() throws Exception {
   
  +        if( this.getService() != null ) {
  +            log.info( "Already configured" );
  +            return;
  +        }
  +        if( container==null ) {
  +            findContainer();
           }
       }
   
  
  
  

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

Reply via email to