|
From: David H. <dho...@gm...> - 2011-05-17 08:16:34
|
I have the wrapper installed on Linux as a service and need as close
to 100% up time as is possible. The wrapper recently received a
WRAPPER_CTRL_TERM_EVENT and shut the app and wrapper down. My
controlEvent() is like this...as copied from some JSW sample code...
public void controlEvent(int event) {
try {
if (WrapperManager.isControlledByNativeWrapper()) {
// The Wrapper will take care of this event
} else {
// We are not being controlled by the Wrapper, so
handle the event ourselves.
if ((event == WrapperManager.WRAPPER_CTRL_C_EVENT) ||
(event == WrapperManager.WRAPPER_CTRL_CLOSE_EVENT) || (event ==
WrapperManager.WRAPPER_CTRL_SHUTDOWN_EVENT)) {
log.warn("We are handling the received event
ourselves and we are stopping the service");
WrapperManager.stop(0);
}
}
}
}
Now I see that recent javadocs say to use...(unless one knows what
they are doing)
public void controlEvent( int event )
{
if ( ( event == WrapperManager.WRAPPER_CTRL_LOGOFF_EVENT ) &&
WrapperManager.isLaunchedAsService() )
{
// Ignore
} else {
WrapperManager.stop( 0 );
}
}
It seems neither of these handle WRAPPER_CTRL_TERM_EVENT in a way that
provides 100% up time, rather it just shuts things down cleanly.
What is the right way to handle this? I.e. should I ignore the
signal? should I restart after shutdown? How?
Thanks,
-Dave
|