void waitForExit ( ) { Runtime runtime = Runtime . getRuntime ( ) ; ShutdownSystem shutdown = _resinSystem . getSystem ( ShutdownSystem . class ) ; if ( shutdown == null ) { throw new IllegalStateException ( L . l ( "'{0}' requires an active {1}" , this , ShutdownSystem . class . getSimpleName ( ) ) ) ; } /* * If the server has a parent process watching over us, close * gracefully when the parent dies. */ while ( ! _server . isClosing ( ) ) { try { Thread . sleep ( 10 ) ; if ( ! checkMemory ( runtime ) ) { shutdown . shutdown ( ShutdownModeAmp . IMMEDIATE , ExitCode . MEMORY , "Server shutdown from out of memory" ) ; // dumpHeapOnExit(); return ; } if ( ! checkFileDescriptor ( ) ) { shutdown . shutdown ( ShutdownModeAmp . IMMEDIATE , ExitCode . MEMORY , "Server shutdown from out of file descriptors" ) ; //dumpHeapOnExit(); return ; } synchronized ( this ) { wait ( 10000 ) ; } } catch ( OutOfMemoryError e ) { String msg = "Server shutdown from out of memory" ; ShutdownSystem . shutdownOutOfMemory ( msg ) ; } catch ( Throwable e ) { log . log ( Level . WARNING , e . toString ( ) , e ) ; return ; } } }
Thread to wait until Resin should be stopped .