World Map
Java Service Wrapper is the easiest way to make your product more reliable.
  • Free Trial
  • Buy Now
wrapper.disable_shutdown_hook Property

wrapper.disable_shutdown_hook

Compatibility : 1.0.0
Editions :Professional EditionStandard EditionCommunity Edition
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/OSIBM z/Linux

WARNING

DO NOT modify any of these parameters unless you have read this property description. Incorrect settings can cause the Wrapper to fail to operate as expected.

Disable detection of calls to System.exit(). If disabled, calls to System.exit() will be treated as if the JVM had crashed and the Service will be restarted.

The Wrapper registers a Shutdown Hook by default. If an application ever calls System.exit() rather than calling WrapperManager.stop() to stop the service, then the Wrapper will correctly shutdown the server.

You may wish to disable the Shutdown Hook for a number of reasons.

If an application contains code which sometimes fails and calls System.exit(), this property can be useful to make sure that the server comes back up. In most cases however, the wrapper.on_exit.<n> is better suited for resolving this problem.

Example:
wrapper.disable_shutdown_hook=TRUE

WARNING

When the Wrapper detects that System.exit() has been called, it will call the stop() method on your application if it implements the WrapperListener method. You must be careful that your application does not call System.exit() again or call the dispose() method on an AWT frame or window. Either one of these actions will result in a deadlock when called from within a ShutdownHook thread due to the way Java has implemented these methods. If either of these cases can not be avoided, then the Shutdown Hook should be disabled.

If you have control over whether the System.exit() or dispose() methods are called, you may be able to make use of the WrapperManager.hasShutdownHookBeenTriggered() method to avoid the deadlock issue.

For more information on the AWT deadlock bug, see the full description of bug #4712342 on Sun's site.

Reference: Shutdown

The Java Service Wrapper provides a full set of configuration properties that allows you to make the Wrapper meet your exact needs. Please take a look at the documentation for the individual properties to see all of the possibilities beyond the examples shown above.