Timer Swiftlet
The Timer Swiftlet manages internal timers of a SwiftMQ router.
Minimum / Maximum Delay
There are 2 attributes in the Timer Swiftlet's configuration which can be configured.
The first is min-delay
. It specifies the number of milliseconds the
internal dispatcher has to wait at a minimum before it checks its
dispatch queue to fire outstanding timers. This delay is useful to avoid
very short delays such as 1 millisecond. These very short delays can
have impact on CPU usage so it is recommended to use the default value
of 100 milliseconds here. The dispatcher then waits at least this amount
of time and fires all outstanding timers at once.
The second attribute is max-delay
. It specifies the number of
milliseconds the dispatcher waits at a maximum to check its dispatch
queue. This delay avoids that the dispatcher waits too long in case the
system time has been changed while the router is running, for example,
due to summer / winter time changes. The default value is 10 seconds
(10000 milliseconds), so the dispatcher checks its dispatch queue at
least every 10 seconds for outstanding timers.
System Time Changes
The Timer Swiftlet is able to detect system time changes, e.g. due to NTP synchronization or Summer / Winter time changes.
Definition: The system time has changed a) if the current time is less
the previous measured time or b) if the current time is greater than
max-delay
+1000.
In this case the delta between current and previous time is applied to all timers not marked as absolute timers, the internal timer task queue is reordered, and the following line is written to the info.log:
System time has changed (delta=nnnnn), reordering timer task queue
where nnnnn
is a millisecond value.
Configuration
The configuration of the Timer Swiftlet is defined within the element
<swiftlet name="sys$timer" .../>
of the router's configuration file. One can use the SwiftMQ Exlorer or CLI for configuration as well. They both save into that file.
Attributes of Element "swiftlet"
Definition
Attribute | Type | Mandatory | Description |
---|---|---|---|
min-delay | java.lang.Long | No | Minimum Delay |
max-delay | java.lang.Long | No | Maximum Delay |
Values
Attribute | Values |
---|---|
min-delay | Min: 0 Default: 100 |
max-delay | Min: 1000 Default: 10000 |