World Map
Java Service Wrapper is the easiest way to make your product more reliable.
  • Free Trial
  • Buy Now
wrapper.timer.<n>.<x> Properties

wrapper.timer.<n>.<x>

Kompatibel :3.3.0
Editionen :Professional EditionStandard Edition (Not Supported)Community Edition (Not Supported)
Betriebssysteme :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.

The timer properties make it possible to schedule JVM restarts, shutdowns, or thread dumps at specific times or intervals in a cron-job like fashion. This can be useful in cases where the user application leaks memory or has other requirements which require periodic restarts.

Basic Setting:

The following example will restart the JVM every day at exactly 4am.

Example:
wrapper.timer.1.action=RESTART
wrapper.timer.1.interval=hour=4

Each timer declaration consists of two properties. The wrapper.timer.<n>.action and wrapper.timer.<n>.interval properties. The "<n>" component of the property name is an integer number counting up from "1". By default, there can be no missing numbers. The wrapper.ignore_sequence_gaps property can optionally be set to allow gaps in the sequence.

More than one actions:

Starting with Wrapper version 3.5.0, it is possible to specify more than one actions by separating them with a space or comma. When more than one action is specified, they will be executed in rapid succession in the order specified.

The following example will perform a thread dump and then restart the JVM every day at 4am.

Example:
wrapper.timer.1.action=DUMP,RESTART
wrapper.timer.1.interval=hour=4

wrapper.timer.<n>.action property

Kompatibel :3.3.0
Editionen :Professional EditionStandard Edition (Not Supported)Community Edition (Not Supported)
Betriebssysteme :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/OSIBM z/Linux

Timer actions can have the following values:

  • DEBUG :

    Each time the timer is fired, a debug message will be logged. This is only really useful in helping to understand how the timers work.

  • DUMP :

    Requests that the JVM perform a thread dump each time the timer is fired. This can be useful to track down memory or performance problems when you are not sure exactly when they are taking place. Make sure your logging properties have been set up to handle large log files if you set the interval to a high rate. Ignored if the JVM is not running.

  • GC (Since ver. 3.5.7) :

    will invoke a full garbage collection sweep in the JVM. Be aware that doing this frequently can affect performance of the JVM as a full sweep will often cause all threads to freeze for the duration of the GC. Ignored if the JVM is not running.

  • RESTART :

    The Java application will be restarted each time the timer is fired. Ignored if the JVM is not running.

  • SHUTDOWN :

    The Wrapper will be shutdown when the timer is fired. This can obviously only happen once unless the Wrapper is being relaunched externally.

  • USER_<n> (Since ver. 3.5.0) (Professional Edition) : A user defined event to be fired.

  • PAUSE (Since ver. 3.5.0) :

    The Java application will be paused if pausing is enabled and the JVM is running. See the wrapper.pausable property for details.

  • RESUME (Since ver. 3.5.0) :

    The Java application will be resumed if in a paused state. This could be used if the JVM is not stopped when paused. See the wrapper.pausable property for details.

  • NONE :

    This effectively disables the timer. It can be useful to disable a timer rather than deleting it to avoid having to renumber successive timers.

wrapper.timer.<n>.interval property

Kompatibel :3.3.0
Editionen :Professional EditionStandard Edition (Not Supported)Community Edition (Not Supported)
Betriebssysteme :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/OSIBM z/Linux

Timer intervals can be built up using a combination of tokens. For example, the following example will "restart the JVM every second day at 04:30:10":

Example:
wrapper.timer.1.action=RESTART
wrapper.timer.1.interval=day-of-week=*/2; hour=4; minute=30; second=10

Interval tokens can have the following values:

  • day-of-week : Specifies the day of the week. Acceptable values in the range 1 (Sunday) - 7 (Saturday).

  • hour : Specifies the hour of the day. Acceptable values in the range 0 - 23.

  • minute : Specifies the minute. Acceptable values in the range 0 - 59.

  • second : Specifies the second. Acceptable values in the range 0 - 59.

Token values can have the following formats:

  • Absolute value : A value like 5 is used to specify a single value. For example, "hour=5" means "5 o'clock".

  • All values : A value like * is used to specify all possible values for the token as well as a wildcard character.

  • Value interval : A value like */5 is used to specify a set of values at regular intervals starting with the minimum possible value for the token. So the value */5 for the "minute" token would define a value "every 5 minutes".

In most cases, not all possible tokens will be specified in an interval declaration. When tokens are omitted, larger tokens will get a default value of *. Smaller tokens will be set to the minimum token value.

These declarations are identical:
wrapper.timer.1.interval=hour=4
wrapper.timer.1.interval=hour=4; minute=0; second=0
wrapper.timer.1.interval=day-of-week=*; hour=4
wrapper.timer.1.interval=day-of-week=*; hour=4; minute=0; second=0