From: Leif M. <le...@ta...> - 2003-05-29 07:15:23
|
Paul Casanova wrote: >First up Leif, I would like to thank and congratulate you and everyone else >who has worked on the Java Service Wrapper for making such a fantastic >configurable and scaleable product available to us all. > Thanks, glad you find it useful. >I manage a complex Java application for a client. The application has >(now) 5 components as follows: >Tomcat 4.1.24 >RMI Registry >AutoUpdater >MainServer (-Xmx1100) >AdditionalServer (-Xmx1100) > Wow. My limit so far has been 512MB >All of these now start and stop beautifully individually via the Windows >Services applet. Previously when we took over support of the application, >the "srvany" Microsoft tool (horrid) was being used to start and stop the >components of the application individually and as a whole using "net >stop..." and "net start..." commands inside batch scripts. > >I can start them all at once successfully from a batch file using "net >start..." eg: >net start service1 >net start service2 >... > >However, using this approach to stop all the services together (eg for >nightly database backup) now times out though because the applications are >being shut down cleanly, rather than just being killed off (ala "srvany"). > >I have a dependency for all of the services (except Tomcat) on the >RMIRegistry, which works fine through the Services applet - when it starts, >they all start; when it stops, they all stop. No problem. > >However, the "net stop" command ignores this dependency, and doesn't stop >or start the other services when it is stopped or started. > >What is the preferred method of stopping several Java Service Wrapper >services at the same time? The first 3 services mentioned aren't a problem >because they are relatively small and simple (< 20MB). However, the last 2 >use up to 1.1GB of RAM each (yeah, I know - quite large) and have large >database connection pools and things they need to clean up before they can >exit cleanly. > 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. The only thing I can think of would be to either write a C (or Java) application that would be a little smarter about waiting for each process to stop. An easy way to do this would be to have your batch file pause for a minute or so after each call to "net stop <apl>". This way you could guarantee that enough time was allowed for the application to actually stop. I assume that net stop is timing out, but that the Wrapper is continuing to stop the service anyway and it will eventually exit on its own. Looking into this, there does not seem to be an easy way to wait in a batch file. But I did locate this page which describes how to use the PING command to ping a host for n seconds and then complete. This will effectively pause your batch file for n seconds. http://www.robvanderwoude.com/index.html Their example is pretty complex because it is designed to work on any windows version. But you basically just place a call like the following into your batch file where you want to wait for 60 seconds: PING 1.1.1.1 -n 60 -w 1000 >NUL Just change the "60" to the number of seconds to wait. >Is there any alternative to "net stop"? >Can the wrapper be configured to have more than 1 shut down method? > What kind of additional shutdown method are you thinking would be useful? If you found the product and support useful, please think about supporting the project: http://wrapper.tanukisoftware.org/doc/english/donate.html Cheers, Leif |