tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Rossbach ...@objektpark.de>
Subject Call stopAwait at StandardServer.stop
Date Sun, 07 Oct 2007 08:35:00 GMT
Hi,

I have reviewed Catalina and StandardServer Tomcat 6 implementation.  
I can see that the old trick with <Server port="-1" ... doesn´t work  
correct. The main thread is not terminate after a stop signal was  
received.

With port=-1 setting a user can start a tomcat without opening a  
shutdown port.  Ok, the only chance to stop a tomcat instance
is to send a signal to the jvm process, but the stopAwait flag at  
StandardServer doesn't trigger.

Catalina.stop ...
         // Shut down the server
         if (server instanceof Lifecycle) {
             try {
                 ((Lifecycle) server).stop();
             } catch (LifecycleException e) {
                 log.error("Catalina.stop", e);
             }
         }

calls only StandardServer stop, but stop doesn't trigger the  
stopAwait flag

     public void stop() throws LifecycleException {

         // Validate and update our current component state
         if (!started)
             return;

         // Notify our interested LifecycleListeners
         lifecycle.fireLifecycleEvent(BEFORE_STOP_EVENT, null);

         lifecycle.fireLifecycleEvent(STOP_EVENT, null);
         started = false;

         // Stop our defined Services
         for (int i = 0; i < services.length; i++) {
             if (services[i] instanceof Lifecycle)
                 ((Lifecycle) services[i]).stop();
         }

         // Notify our interested LifecycleListeners
         lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT, null);

     }

can we please fix it:

     public void stop() throws LifecycleException {

         // Validate and update our current component state
         if (!started)
             return;

         // Notify our interested LifecycleListeners
         lifecycle.fireLifecycleEvent(BEFORE_STOP_EVENT, null);

         lifecycle.fireLifecycleEvent(STOP_EVENT, null);
         started = false;

         // Stop our defined Services
         for (int i = 0; i < services.length; i++) {
             if (services[i] instanceof Lifecycle)
                 ((Lifecycle) services[i]).stop();
         }
	// ====== FIX BEGIN
	if(port == -1)
		stopAwait() ;
        // ====== END
         // Notify our interested LifecycleListeners
         lifecycle.fireLifecycleEvent(AFTER_STOP_EVENT, null);

     }

I think we can also backport it to Tomcat 5.5 trunk

regards
Peter




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


Mime
View raw message