tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net PoolTcpEndpoint.java
Date Thu, 16 May 2002 18:57:39 GMT
remm        02/05/16 11:57:39

  Modified:    coyote/src/java/org/apache/coyote ProtocolHandler.java
               coyote/src/java/org/apache/coyote/tomcat4
                        CoyoteConnector.java LocalStrings.properties
               http11/src/java/org/apache/coyote/http11 Http11Protocol.java
               jk/java/org/apache/jk/server JkCoyoteHandler.java
               util/java/org/apache/tomcat/util/net PoolTcpEndpoint.java
  Log:
  - Add support for a two phase protocol init (init where the port binding occurs,
    and start where the connector is actually started). This allows to run TC on port
    80 without root on Unix, as it was possible with the old HTTP/1.1 connector.
  - The modified endpoint should be 100% compatible with all existing code using
    it (the start method calls the init method if it hasn't been called before).
  
  Revision  Changes    Path
  1.3       +8 -1      jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/ProtocolHandler.java
  
  Index: ProtocolHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/ProtocolHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProtocolHandler.java	5 Apr 2002 15:52:45 -0000	1.2
  +++ ProtocolHandler.java	16 May 2002 18:57:39 -0000	1.3
  @@ -93,9 +93,16 @@
   
   
       /**
  -     * Start the protocol.
  +     * Init the protocol.
        */
       public void init()
  +        throws Exception;
  +
  +
  +    /**
  +     * Start the protocol.
  +     */
  +    public void start()
           throws Exception;
   
   
  
  
  
  1.14      +14 -6     jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteConnector.java
  
  Index: CoyoteConnector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteConnector.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- CoyoteConnector.java	6 May 2002 21:43:29 -0000	1.13
  +++ CoyoteConnector.java	16 May 2002 18:57:39 -0000	1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteConnector.java,v
1.13 2002/05/06 21:43:29 remm Exp $
  - * $Revision: 1.13 $
  - * $Date: 2002/05/06 21:43:29 $
  + * $Header: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteConnector.java,v
1.14 2002/05/16 18:57:39 remm Exp $
  + * $Revision: 1.14 $
  + * $Date: 2002/05/16 18:57:39 $
    *
    * ====================================================================
    *
  @@ -112,7 +112,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.13 $ $Date: 2002/05/06 21:43:29 $
  + * @version $Revision: 1.14 $ $Date: 2002/05/16 18:57:39 $
    */
   
   
  @@ -995,6 +995,14 @@
                                              "" + false);
           }
   
  +        try {
  +            protocolHandler.init();
  +        } catch (Exception e) {
  +            throw new LifecycleException
  +                (sm.getString
  +                 ("coyoteConnector.protocolHandlerInitializationFailed", e));
  +        }
  +
       }
   
   
  @@ -1013,11 +1021,11 @@
           started = true;
   
           try {
  -            protocolHandler.init();
  +            protocolHandler.start();
           } catch (Exception e) {
               throw new LifecycleException
                   (sm.getString
  -                 ("coyoteConnector.protocolHandlerInitializationFailed", e));
  +                 ("coyoteConnector.protocolHandlerStartFailed", e));
           }
   
       }
  
  
  
  1.4       +1 -0      jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/LocalStrings.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LocalStrings.properties	18 Apr 2002 18:12:46 -0000	1.3
  +++ LocalStrings.properties	16 May 2002 18:57:39 -0000	1.4
  @@ -9,6 +9,7 @@
   coyoteConnector.protocolHandlerDestroyFailed=Protocol handler destroy failed: {0}
   coyoteConnector.protocolHandlerInitializationFailed=Protocol handler initialization failed:
{0}
   coyoteConnector.protocolHandlerInstantiationFailed=Protocol handler instantiation failed:
{0}
  +coyoteConnector.protocolHandlerStartFailed=Protocol handler start failed: {0}
   
   #
   # CoyoteAdapter
  
  
  
  1.12      +13 -3     jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java
  
  Index: Http11Protocol.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Protocol.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Http11Protocol.java	26 Apr 2002 20:13:43 -0000	1.11
  +++ Http11Protocol.java	16 May 2002 18:57:39 -0000	1.12
  @@ -137,15 +137,25 @@
                   socketFactory.setAttribute( key, v );
               }
           }
  +
           try {
  -            ep.startEndpoint();
  +            ep.initEndpoint();
           } catch (Exception ex) {
               log.error("Error initializing endpoint", ex);
               throw ex;
           }
  -        log.info( "Starting on " + ep.getPort() );
  +        log.info( "Init on " + ep.getPort() );
   
  -        
  +    }
  +
  +    public void start() throws Exception {
  +        try {
  +            ep.startEndpoint();
  +        } catch (Exception ex) {
  +            log.error("Error starting endpoint", ex);
  +            throw ex;
  +        }
  +        log.info( "Starting on " + ep.getPort() );
       }
   
       public void destroy() throws Exception {
  
  
  
  1.21      +3 -0      jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkCoyoteHandler.java
  
  Index: JkCoyoteHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/server/JkCoyoteHandler.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- JkCoyoteHandler.java	10 May 2002 23:57:35 -0000	1.20
  +++ JkCoyoteHandler.java	16 May 2002 18:57:39 -0000	1.21
  @@ -153,6 +153,9 @@
           }
       }
   
  +    public void start() {
  +    }
  +
       public void destroy() {
           if( !started ) return;
   
  
  
  
  1.4       +12 -4     jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java
  
  Index: PoolTcpEndpoint.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PoolTcpEndpoint.java	15 May 2002 18:53:46 -0000	1.3
  +++ PoolTcpEndpoint.java	16 May 2002 18:57:39 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v
1.3 2002/05/15 18:53:46 keith Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/05/15 18:53:46 $
  + * $Header: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/PoolTcpEndpoint.java,v
1.4 2002/05/16 18:57:39 remm Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/05/16 18:57:39 $
    *
    * ====================================================================
    *
  @@ -117,6 +117,7 @@
   
       ThreadPoolRunnable listener;
       private boolean running = false;
  +    private boolean initialized = false;
       static final int debug=0;
   
       ThreadPool tp;
  @@ -252,7 +253,7 @@
   
       // -------------------- Public methods --------------------
   
  -    public void startEndpoint() throws IOException, InstantiationException {
  +    public void initEndpoint() throws IOException, InstantiationException {
   	try {
   	    if(factory==null)
   		factory=ServerSocketFactory.getDefault();
  @@ -276,6 +277,13 @@
   	    //	    log("couldn't start endpoint", ex1, Logger.DEBUG);
               throw ex1;
   	}
  +        initialized = true;
  +    }
  +
  +    public void startEndpoint() throws IOException, InstantiationException {
  +        if (!initialized) {
  +            initEndpoint();
  +        }
   	if(isPool) {
   	    tp.start();
   	}
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message