index

wrapper.timer.<n>.<x>

Compatibility :3.3.0
Editions :Professional EditionStandard Edition (Not Supported)Community Edition (Not Supported)
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.

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 that require periodic restarts.

Basic Setting:

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

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

Each timer declaration consists of two properties:

<n> component:

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.

wrapper.timer.<n>.action property

Compatibility :3.3.0
Editions :Professional EditionStandard Edition (Not Supported)Community Edition (Not Supported)
Platforms :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.

  • STATS (Since ver. 3.5.52, Standard /Professional Edition):

    will print performance statistics.

  • 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.

  • SUSPEND_TIMEOUTS_<n> (Since ver. 3.5.40, Standard /Professional Edition):

    Tells the Wrapper to suspend all timeouts used when the JVM is not responding. <n> specifies the number of seconds to suspend timeouts, and should be in the range 1-3600 (1h). This could be used if the Java application needs to perform a long blocking task and avoid having the Wrapper considering the application as unresponsive.

    Timeouts can also be suspended via other action properties, the command file or the Java WrapperManager.suspendTimeouts() method.

    If several requests to suspend timeouts are made, the number of seconds specified by each request will not be summed. Instead, the newly specified time will replace the remaining suspension time if it is longer, and will be ignored otherwise.

  • RESUME_TIMEOUTS (Since ver. 3.5.40, Standard /Professional Edition):

    Tells the Wrapper to resume all timeouts previously suspended.

    Timeouts can also be resumed via other action properties, the command file or the Java WrapperManager.resumeTimeouts() method.

  • 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.

Chaining Multiple Actions:

Starting with Wrapper version 3.5.0, it is possible to specify more than one action 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 4 a.m.

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

wrapper.timer.<n>.interval property

Compatibility :3.3.0
Editions :Professional EditionStandard Edition (Not Supported)Community Edition (Not Supported)
Platforms :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.

    For example, "hour=*" is the same as "hour=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23".

  • All values, starting at offset: (Version 3.5.25)

    A value like *+OFFSET is used to specify all possible values for the token, starting with the specified offset.

    For example, "hour=*+10" is the same as "hour=10,11,12,13,14,15,16,17,18,19,20,21,22,23".

  • Value interval:

    A value like */INTERVAL is used to specify a set of values at regular intervals starting with the minimum possible value for the token.

    For example, "minute=*/5" is the same as "minute=0,5,10,15,20,25,30,35,40,45,50,55", meaning that the timer will fire every 5 minutes.

  • Value interval, starting at offset: (Version 3.5.25)

    A value like *+OFFSET/INTERVAL is used to specify a set of values at regular intervals starting with the minimum possible value for the token plus the specified offset.

    For example, "minute=*+3/5" is the same as "minute=3,8,13,18,23,28,33,38,43,48,53,58", meaning that the timer will fire every 5 minutes starting with the 3rd minute.

  • Range of values: (Version 3.5.25)

    A value like LOW-HIGH is used to specify a range of values.

    For example, "minute=5-8" is the same as "minute=5,6,7,8".

  • Value lists: (Version 3.5.25)

    Any of the above can be combined into a comma separated list.

    For example, "minute=*/10,*+2/10" is the same as "minute=0,2,10,12,20,22,30,32,40,42,50,52".

    For example, "minute=1-3,10-12" is the same as "minute=1,2,3,10,11,12".

    For example, "minute=2-5,*/10" is the same as "minute=0,2,3,4,5,10,20,30,40,50".

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

wrapper.timer.max_catchup property

Compatibility :3.3.0
Editions :Professional EditionStandard Edition (Not Supported)Community Edition (Not Supported)
Platforms :WindowsMac OSXLinuxIBM AIXFreeBSDHP-UXSolarisIBM z/OSIBM z/Linux

When the system time changes, it is possible that one or more timer events would have been fired during that time range. The Wrapper will attempt to catch up by firing all of those events in rapid succession. When the number is large, this can cause unwanted results.

This property makes it possible to configure the maximum amount of time that the timer will be allowed to catch up. The default value is "60 seconds".

Example: (60 seconds)
wrapper.timer.max_catchup=60

NOTE

Starting from version 3.5.29, the Wrapper uses a new method to catch up timers that would be scheduled during the time skipped or repeated because of a daylight saving time changeover.

When the clock moves forward to change to summer time, only timers that were scheduled on a daily basis during the time that was skipped will catch up.

In the same way, when the clock moves backwards, timers scheduled daily will not be re-executed.

The concerned timers are those not using '*' in the 'hour' or 'minute' specifiers, and having either 'day-of-week' or 'hour' specified.

NOTE

There was an issue prior to Wrapper version 3.5.24 that could cause timers to stop working if they had been scheduled during the catchup interval. This property should be set to a value large enough to prevent that from happening. A value of 3600 will prevent problems during time zone changes.