From: Leif M. <le...@ta...> - 2003-05-29 08:33:39
|
Paul Casanova wrote: >Thanks for responding so fast! > >>I want to confirm that your problem is not that the Wrapper is timing >>out and >>killing the JVM prematurely. I don't think it is from what you said. >> >> >I initially set it all up with DEBUG turned on, until I got it running with >all errors gone. I did have to increase the timeout periods, but yes I >believe that when the services are stopped individually from the Services >applet, they exit without error. > >You're right - even though "net stop" bombs out with an error ("service >could not be stopped..." or something), the services do appear to have >stopped in the Services applet. I'm just a little nervous about putting >that into production. > I'll do some more testing to make sure that "net stop" is not timing out because of a problem with the Wrapper. The Wrapper should be notifying the Service Manager that it needs more time to shutdown cleanly every few moments. Same happens as the server is starting up. >The extra method I was thinking of is for the nightly backup situation, >where it's pretty much guaranteed that users will be off the system >(midnight), perhaps another class could be written which ends the services >more abruptly or something. I'm pretty new on the services side of things, >so this may either be a valid idea, or complete nonsense that I'm >suggesting!! > That is possible by setting the shutdown timeouts to very short values within the wrapper.conf file. But there is only one of those. The problem is that there are not multiple commands coming from the ServiceManager based on the time. It would be possible to add something to the wrapper.conf where you could define windows of time where the Wrapper would immediately kill the JVM rather than requesting the JVM to shutdown cleanly. If possible I would like to avoid doing this as I don't think this a very common problem however. You could implement this behavior easily in your own applications by adding a check to the beginning of your application's shutdown hook. If the current time is within a certain window, execute the following code. If you call halt outside a shutdown hook, and the Wrapper has not requested that the JVM shutdown, then it will interpret the JVM exiting as it having crashed and will restart the JVM. The call to signalStopped is to tell the Wrapper that the JVM is exiting intentionally so it is not restarted. System.exit will shutdown cleanly and the Wrapper will handle it correctly. WrapperManager.signalStopped( 0 ) Runtime.getRuntime().halt(0) Hope this helps. Cheers, Leif |