Index

wrapper.on_exit.<n>

Compatibilidad :3.1.0
Ediciones :Edición ProfesionaEdición EstándarEdición de la Comunidad
Plataformas :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/OSIBM z/Linux

Some applications are good about returning "exit codes" with meaning. In such cases, it may be desirable to restart the application in the event that it exits with certain exit codes. This set of properties makes this possible.

wrapper.on_exit.default

It's possible to specify an action to take for any exit code by making use of the wrapper.on_exit.default property and setting it to either SHUTDOWN or RESTART. The default value is SHUTDOWN.

The action can be one of the following:

  • RESTART
  • SHUTDOWN
  • PAUSE (Since ver. 3.5.0) : will put the Wrapper into a paused state. This delays the restart of the JVM until the Wrapper is resumed. If Wrapper's pausing is not enabled then the JVM will be restart as if the RESTART action was configured. See the wrapper.pausable property for details.
Example: (Default Action)
wrapper.on_exit.default=SHUTDOWN

wrapper.on_exit.<n>

In addition, it is possible to specify what will happen for a specific exit code by defining a property whose name is wrapper.on_exit. followed by the exit code.

The property name starts with wrapper.on_exit.<n>. and the "<n>" component of the property name is an exit code.

The action can be one of the following:

  • RESTART : will launch a new JVM.
  • SHUTDOWN : will proceed to shutdown the Wrapper.
  • PAUSE (Since ver. 3.5.0) : will put the Wrapper into a paused state. This delays the restart of the JVM until the Wrapper is resumed. If Wrapper's pausing is not enabled then the JVM will be restarted as if the RESTART action had been configured. See the wrapper.pausable property for details.

If an on_exit.<n> property is not defined for a given exit code, then it will default to the value of the wrapper.on_exit.default property.

Example: (Restart on the exit code 1)
wrapper.on_exit.1=RESTART

Usage Example:

To configure the Wrapper to restart the JVM for all exit codes except the exit code "0" (zero), use the following:

Example: (Exit code "0": Shutdown JVM, All the other exit codes: Restart JVM)
wrapper.on_exit.default=RESTART
wrapper.on_exit.0=SHUTDOWN

on_exit properties will be triggered by calls to WrapperManager.stop(n), WrapperManager.stopImmediate(n), and System.exit(n).

External signals or actions which trigger the shutdown of the Wrapper and its JVM will cause these properties to be ignored as the Wrapper is shutting down. This means configuring the Wrapper to restart on any exit code will not prevent the Wrapper from shutting down.