Author: costin Date: Fri Oct 14 23:56:28 2005 New Revision: 321301 URL: http://svn.apache.org/viewcvs?rev=321301&view=rev Log: Add few more comments, and a special case dealing with invalid shutdown ports - if -1 or -2 are specified, don't open any shutdown port, instead rely on the embedding app.
This is only intended for 'runtime' - i.e. embeded case, where there is no reason to have a shutdown port for tomcat. It shouldn't hurt any existing use case tough. If you have a better suggestion, please let me know - I can easily replace this with something equivalent. Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardServer.java Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardServer.java URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardServer.java?rev=321301&r1=321300&r2=321301&view=diff ============================================================================== --- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardServer.java (original) +++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/core/StandardServer.java Fri Oct 14 23:56:28 2005 @@ -179,6 +179,7 @@ */ protected PropertyChangeSupport support = new PropertyChangeSupport(this); + private boolean stopAwait = false; // ------------------------------------------------------------- Properties @@ -331,12 +332,31 @@ } + public void stopAwait() { + stopAwait=true; + } /** * Wait until a proper shutdown command is received, then return. + * This keeps the main thread alive - the thread pool listening for http + * connections is daemon threads. */ public void await() { - + // Negative values - don't wait on port - tomcat is embedded or we just don't like ports + if( port == -2 ) { + // undocumented yet - for embedding apps that are around, alive. + return; + } + if( port==-1 ) { + while( true ) { + try { + Thread.sleep( 100000 ); + } catch( InterruptedException ex ) { + } + if( stopAwait ) return; + } + } + // Set up a server socket to wait on ServerSocket serverSocket = null; try { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]