javax.management.timer package
Provides the definition of the Timer MBean. A Timer MBean
maintains a list of scheduled notifications and, because it is a
{@link javax.management.NotificationBroadcaster
NotificationBroadcaster}, a list of listeners for those
notifications. Whenever the time for one of the scheduled
notifications is reached, each listener receives the
notification. Notifications can be repeated at a fixed
interval, and the number of repetitions can be bounded.
A listener for a Timer MBean can itself be an MBean, using
the method {@link
javax.management.MBeanServer#addNotificationListener(ObjectName,
ObjectName, NotificationFilter, Object)}. In this way, a
management application can create an MBean representing a task,
then schedule that task using a Timer MBean.
@since 1.5
|
Timer.java | Class | Provides the implementation of the timer MBean.
The timer MBean sends out an alarm at a specified time
that wakes up all the listeners registered to receive timer notifications.
This class manages a list of dated timer notifications.
A method allows users to add/remove as many notifications as required.
When a timer notification is emitted by the timer and becomes obsolete,
it is automatically removed from the list of timer notifications.
Additional timer notifications can be added into regularly repeating notifications.
Note:
- When sending timer notifications, the timer updates the notification sequence number
irrespective of the notification type.
- The timer service relies on the system date of the host where the
Timer class is loaded.
Listeners may receive untimely notifications
if their host has a different system date.
To avoid such problems, synchronize the system date of all host machines where timing is needed.
- The default behavior for periodic notifications is fixed-delay execution, as
specified in
java.util.Timer .
|