|
From: Leif M. <le...@ta...> - 2007-04-09 22:57:57
|
Raymond, WrapperListener.stop() is called by the WrapperManager class when it is attempting to shut down your java application cleanly. In the case of the WrapperSimpleApp implementation, the stop() method does not do anything. Applications using the WrapperSimpleStop helper class are expected to clean themselves up via a shutdown hook. As a general rule though, startup methods should call the super class's method at the beginning of the method and shutdown methods should do so at the end. So follow that pattern and call super.stop() after your code has executed. That said however, the stop() method is called when the Wrapper wants to stop the JVM. This can happen in response to an external event like CTRL-C being pressed, or the service manager attempting to stop the service. It can also happen if the Wrapper's internal shutdown hook is started in response to the JVM shutdown starting on its own via a call to System.exit or something. Important note is that the stop() method will ONLY be called for clean shutdowns of the JVM. If the JVM crashes or is killed because it has hung, the stop() method will never be called. I have been working on a feature to allow the execution of external applications in response to things like the JVM being restarted or stopped. This needs to happen from the wrapper process, implemented in C, to make sure that those applications are always launched. Cheers, Leif Raymond Bleach wrote: > > We have set up the wrapper as an NT service using the WrapperSimpleApp > class. This is used to start a vendor supplied process that handles > RPC requests. > > Now I have a need to execute some custom code whenever the NT service > is stopped so that I can perform some cleanup and rolling of logs > after the vendors’ process terminates. > > I am looking at extending the WrapperSimpleApp and adding my custom > code into the stop() method. I need to execute my code after the > vendor’s code has stopped. > > Q: Is the stop() method called after the wrapper.app.parameter.1 has > completed ? > > Q: Should I call the super.stop() method before or after execution of > my custom code? > |