You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Matthias Kaldenbach <ma...@matthias-kaldenbach.de> on 2001/03/13 13:15:40 UTC

Stopping Tomcat in same JVM stops everything

Tomcat 3.2.1 as Thread in same JVM: how to stop/restart properly?
(Windows NT, as standalone-HTTP-server)

I'd like to run Tomcat embedded as Thread in an own application.
It should be possible to restart Tomcat without restarting the
whole application.

But stopping Tomcat by calling the main(...) method of
org.apache.tomcat.startup.Tomcat will finally send a
signal "15" to the Ajp12ConnectionHandler which leads
to a System.exit(0). Unfortunately this also stops any
other running threads, including the invoking one...

Therefore I think the following code should be improved:

(from org.apache.tomcat.service.connector.Ajp12ConnectionHandler:)

if ( (signal== 15) && isSameAddress(serverAddr, clientAddr) ) {
  // Shutdown - probably apache was stoped with apachectl stop
  contextM.stop();
  // same behavior as in past, because it seems that
  // stopping everything doesn't work - need to figure
  // out what happens with the threads ( XXX )
  System.exit(0);
  shutdown=true;
  return;
}

In addition I think, there should be a "restart" option.

Has anyone got a good solution for stopping and restarting
a Tomcat instance within the same JVM?


Greetings

Matthias

+------------------------+------------------------------------+
| Matthias Kaldenbach    | call:+49(0)631/60848               |
| Tannenstrasse 14       | http://www.matthias-kaldenbach.de  |
| D-67655 Kaiserslautern | mailto:mail@matthias-kaldenbach.de |
+------------------------+------------------------------------+

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