APIdia Launch Partner
Top Description Fields Constructors Methods
javax.management.timer

public Class Timer

extends NotificationBroadcasterSupport
implements TimerMBean, MBeanRegistration
Class Inheritance
All Implemented Interfaces
javax.management.MBeanRegistration, javax.management.timer.TimerMBean
Static Imports
com.sun.jmx.defaults.JmxProperties.TIMER_LOGGER

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

  1. When sending timer notifications, the timer updates the notification sequence number irrespective of the notification type.
  2. 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.
  3. The default behavior for periodic notifications is fixed-delay execution, as specified in java.util.Timer. In order to use fixed-rate execution, use the overloaded addNotification(String, String, Object, Date, long, long, boolean) method.
  4. Notification listeners are potentially all executed in the same thread. Therefore, they should execute rapidly to avoid holding up other listeners or perturbing the regularity of fixed-delay executions. See NotificationBroadcasterSupport.
Since
1.5

Field Summary

Modifier and TypeField and Description
private static final int
private volatile int
counterID

The notification counter ID. Used to keep the max key value inserted into the timer table.

private static final int
private transient boolean
isActive

Timer state.

public static final long
ONE_DAY

Number of milliseconds in one day.

public static final long
ONE_HOUR

Number of milliseconds in one hour.

public static final long
ONE_MINUTE

Number of milliseconds in one minute.

public static final long
ONE_SECOND

Number of milliseconds in one second.

public static final long
ONE_WEEK

Number of milliseconds in one week.

private boolean
sendPastNotifications

Past notifications sending on/off flag value.

private transient long
sequenceNumber

Timer sequence number.

private Timer
private static final int
private static final int
private static final int
private static final int
private final Map<Integer, Object[]>
timerTable

Table containing all the timer notifications of this timer, with the associated date, period and number of occurrences.

Constructor Summary

AccessConstructor and Description
public
Timer()

Default constructor.

Method Summary

Modifier and TypeMethod and Description
public synchronized Integer

Returns:

The identifier of the new created timer notification.
addNotification
(String
The timer notification type.
type
,
String
The timer notification detailed message.
message
,
Object
The timer notification user data object.
userData
,
Date
The date when the notification occurs.
date
,
long
The period of the timer notification (in milliseconds).
period
,
long
The total number the timer notification will be emitted.
nbOccurences
,
boolean
If true and if the notification is periodic, the notification is scheduled with a fixed-rate execution scheme. If false and if the notification is periodic, the notification is scheduled with a fixed-delay execution scheme. Ignored if the notification is not periodic.
fixedRate
)

Implements javax.management.timer.TimerMBean.addNotification.

Creates a new timer notification with the specified type, message and userData and inserts it into the list of notifications with a given date, period and number of occurrences.

public synchronized Integer

Returns:

The identifier of the new created timer notification.
addNotification
(String
The timer notification type.
type
,
String
The timer notification detailed message.
message
,
Object
The timer notification user data object.
userData
,
Date
The date when the notification occurs.
date
,
long
The period of the timer notification (in milliseconds).
period
,
long
The total number the timer notification will be emitted.
nbOccurences
)

Implements javax.management.timer.TimerMBean.addNotification.

Creates a new timer notification with the specified type, message and userData and inserts it into the list of notifications with a given date, period and number of occurrences.

public synchronized Integer

Returns:

The identifier of the new created timer notification.
addNotification
(String
The timer notification type.
type
,
String
The timer notification detailed message.
message
,
Object
The timer notification user data object.
userData
,
Date
The date when the notification occurs.
date
,
long
The period of the timer notification (in milliseconds).
period
)

Implements javax.management.timer.TimerMBean.addNotification.

Creates a new timer notification with the specified type, message and userData and inserts it into the list of notifications with a given date and period and a null number of occurrences.

public synchronized Integer

Returns:

The identifier of the new created timer notification.
addNotification
(String
The timer notification type.
type
,
String
The timer notification detailed message.
message
,
Object
The timer notification user data object.
userData
,
Date
The date when the notification occurs.
date
)

Implements javax.management.timer.TimerMBean.addNotification.

Creates a new timer notification with the specified type, message and userData and inserts it into the list of notifications with a given date and a null period and number of occurrences.

public synchronized Vector<Integer>

Returns:

A vector of Integer objects containing all the timer notification identifiers.
The vector is empty if there is no timer notification registered for this timer MBean.
getAllNotificationIDs
()

Implements javax.management.timer.TimerMBean.getAllNotificationIDs.

Gets all timer notification identifiers registered into the list of notifications.

public synchronized Date

Returns:

A copy of the date or null if the identifier is not mapped to any timer notification registered for this timer MBean.
getDate
(Integer
The timer notification identifier.
id
)

Implements javax.management.timer.TimerMBean.getDate.

Gets a copy of the date associated to a timer notification.

public synchronized Boolean

Returns:

A copy of the flag indicating whether a periodic notification is executed at fixed-delay or at fixed-rate.
getFixedRate
(Integer
The timer notification identifier.
id
)

Implements javax.management.timer.TimerMBean.getFixedRate.

Gets a copy of the flag indicating whether a periodic notification is executed at fixed-delay or at fixed-rate.

public synchronized int

Returns:

The number of timer notifications.
getNbNotifications
()

Implements javax.management.timer.TimerMBean.getNbNotifications.

Gets the number of timer notifications registered into the list of notifications.

public synchronized Long

Returns:

A copy of the remaining number of occurrences or null if the identifier is not mapped to any timer notification registered for this timer MBean.
getNbOccurences
(Integer
The timer notification identifier.
id
)

Implements javax.management.timer.TimerMBean.getNbOccurences.

Gets a copy of the remaining number of occurrences associated to a timer notification.

public synchronized Vector<Integer>

Returns:

A vector of Integer objects containing all the identifiers of timer notifications with the specified type.
The vector is empty if there is no timer notifications registered for this timer MBean with the specified type.
getNotificationIDs
(String
The timer notification type.
type
)

Implements javax.management.timer.TimerMBean.getNotificationIDs.

Gets all the identifiers of timer notifications corresponding to the specified type.

public synchronized MBeanNotificationInfo[]
getNotificationInfo()

Overrides javax.management.NotificationBroadcasterSupport.getNotificationInfo.

Implements javax.management.NotificationBroadcaster.getNotificationInfo.

Returns an array indicating, for each notification this MBean may send, the name of the Java class of the notification and the notification type.

public synchronized String

Returns:

The timer notification detailed message or null if the identifier is not mapped to any timer notification registered for this timer MBean.
getNotificationMessage
(Integer
The timer notification identifier.
id
)

Implements javax.management.timer.TimerMBean.getNotificationMessage.

Gets the timer notification detailed message corresponding to the specified identifier.

public synchronized String

Returns:

The timer notification type or null if the identifier is not mapped to any timer notification registered for this timer MBean.
getNotificationType
(Integer
The timer notification identifier.
id
)

Implements javax.management.timer.TimerMBean.getNotificationType.

Gets the timer notification type corresponding to the specified identifier.

public synchronized Object

Returns:

The timer notification user data object or null if the identifier is not mapped to any timer notification registered for this timer MBean.
getNotificationUserData
(Integer
The timer notification identifier.
id
)

Implements javax.management.timer.TimerMBean.getNotificationUserData.

Gets the timer notification user data object corresponding to the specified identifier.

public synchronized Long

Returns:

A copy of the period or null if the identifier is not mapped to any timer notification registered for this timer MBean.
getPeriod
(Integer
The timer notification identifier.
id
)

Implements javax.management.timer.TimerMBean.getPeriod.

Gets a copy of the period (in milliseconds) associated to a timer notification.

public boolean

Returns:

The past notifications sending on/off flag value.
getSendPastNotifications
()

Implements javax.management.timer.TimerMBean.getSendPastNotifications.

Gets the flag indicating whether or not the timer sends past notifications.

public boolean

Returns:

true if the timer MBean is active, false otherwise.
isActive
()

Implements javax.management.timer.TimerMBean.isActive.

Tests whether the timer MBean is active.

public synchronized boolean

Returns:

true if the list of timer notifications is empty, false otherwise.
isEmpty
()

Implements javax.management.timer.TimerMBean.isEmpty.

Tests whether the list of timer notifications is empty.

pack-priv void
notifyAlarmClock(TimerAlarmClockNotification
The TimerAlarmClock notification.
notification
)

This method is called by the timer each time the TimerAlarmClock has exceeded its timeout.

public void
postDeregister()

Implements javax.management.MBeanRegistration.postDeregister.

Allows the timer MBean to perform any operations needed after having been unregistered by the MBean server.

public void
postRegister(Boolean registrationDone)

Implements javax.management.MBeanRegistration.postRegister.

Allows the timer MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.

public void
preDeregister()

Implements javax.management.MBeanRegistration.preDeregister.

Allows the timer MBean to perform any operations it needs before being unregistered by the MBean server.

public ObjectName

Returns:

The name of the timer MBean registered.
preRegister
(MBeanServer
The MBean server in which the timer MBean will be registered.
server
,
ObjectName
The object name of the timer MBean.
name
)

Implements javax.management.MBeanRegistration.preRegister.

Allows the timer MBean to perform any operations it needs before being registered in the MBean server.

public synchronized void
removeAllNotifications()

Implements javax.management.timer.TimerMBean.removeAllNotifications.

Removes all the timer notifications from the list of notifications and resets the counter used to update the timer notification identifiers.

public synchronized void
removeNotification(Integer
The timer notification identifier.
id
)

Implements javax.management.timer.TimerMBean.removeNotification.

Removes the timer notification corresponding to the specified identifier from the list of notifications.

public synchronized void
removeNotifications(String
The timer notification type.
type
)

Implements javax.management.timer.TimerMBean.removeNotifications.

Removes all the timer notifications corresponding to the specified type from the list of notifications.

pack-priv void
sendNotification(Date
The notification emission date.
timeStamp
,
TimerNotification
The timer notification to send.
notification
)

This method is used by the timer MBean to update and send a timer notification to all the listeners registered for this kind of notification.

private synchronized void
sendPastNotifications(Date
The current date.
currentDate
,
boolean
The flag indicating if past notifications must be sent or not.
currentFlag
)

Sends or not past notifications depending on the specified flag.

public void
setSendPastNotifications(boolean
The past notifications sending on/off flag value.
value
)

Implements javax.management.timer.TimerMBean.setSendPastNotifications.

Sets the flag indicating whether the timer sends past notifications or not.

public synchronized void
start()

Implements javax.management.timer.TimerMBean.start.

Starts the timer.

public synchronized void
stop()

Implements javax.management.timer.TimerMBean.stop.

Stops the timer.

private synchronized void
updateTimerTable(Integer
The timer notification identifier to update.
notifID
)

If the timer notification is not periodic, it is removed from the list of notifications.

Inherited from javax.management.NotificationBroadcasterSupport:
addNotificationListenerhandleNotificationremoveNotificationListenerremoveNotificationListenersendNotification

Field Detail

ALARM_CLOCK_INDEXback to summary
private static final int ALARM_CLOCK_INDEX
counterIDback to summary
private volatile int counterID

The notification counter ID. Used to keep the max key value inserted into the timer table.

FIXED_RATE_INDEXback to summary
private static final int FIXED_RATE_INDEX
isActiveback to summary
private transient boolean isActive

Timer state. The default value is set to false.

ONE_DAYback to summary
public static final long ONE_DAY

Number of milliseconds in one day. Useful constant for the addNotification method.

ONE_HOURback to summary
public static final long ONE_HOUR

Number of milliseconds in one hour. Useful constant for the addNotification method.

ONE_MINUTEback to summary
public static final long ONE_MINUTE

Number of milliseconds in one minute. Useful constant for the addNotification method.

ONE_SECONDback to summary
public static final long ONE_SECOND

Number of milliseconds in one second. Useful constant for the addNotification method.

ONE_WEEKback to summary
public static final long ONE_WEEK

Number of milliseconds in one week. Useful constant for the addNotification method.

sendPastNotificationsback to summary
private boolean sendPastNotifications

Past notifications sending on/off flag value. This attribute is used to specify if the timer has to send past notifications after start.
The default value is set to false.

sequenceNumberback to summary
private transient long sequenceNumber

Timer sequence number. The default value is set to 0.

timerback to summary
private Timer timer
TIMER_DATE_INDEXback to summary
private static final int TIMER_DATE_INDEX
TIMER_NB_OCCUR_INDEXback to summary
private static final int TIMER_NB_OCCUR_INDEX
TIMER_NOTIF_INDEXback to summary
private static final int TIMER_NOTIF_INDEX
TIMER_PERIOD_INDEXback to summary
private static final int TIMER_PERIOD_INDEX
timerTableback to summary
private final Map<Integer, Object[]> timerTable

Table containing all the timer notifications of this timer, with the associated date, period and number of occurrences.

Constructor Detail

Timerback to summary
public Timer()

Default constructor.

Method Detail

addNotificationback to summary
public synchronized Integer addNotification(String type, String message, Object userData, Date date, long period, long nbOccurences, boolean fixedRate) throws IllegalArgumentException

Implements javax.management.timer.TimerMBean.addNotification.

Creates a new timer notification with the specified type, message and userData and inserts it into the list of notifications with a given date, period and number of occurrences.

If the timer notification to be inserted has a date that is before the current date, the method behaves as if the specified date were the current date.
For once-off notifications, the notification is delivered immediately.
For periodic notifications, the first notification is delivered immediately and the subsequent ones are spaced as specified by the period parameter.

Note that once the timer notification has been added into the list of notifications, its associated date, period and number of occurrences cannot be updated.

In the case of a periodic notification, the value of parameter fixedRate is used to specify the execution scheme, as specified in java.util.Timer.

Parameters
type:String

The timer notification type.

message:String

The timer notification detailed message.

userData:Object

The timer notification user data object.

date:Date

The date when the notification occurs.

period:long

The period of the timer notification (in milliseconds).

nbOccurences:long

The total number the timer notification will be emitted.

fixedRate:boolean

If true and if the notification is periodic, the notification is scheduled with a fixed-rate execution scheme. If false and if the notification is periodic, the notification is scheduled with a fixed-delay execution scheme. Ignored if the notification is not periodic.

Returns:Integer

The identifier of the new created timer notification.

Exceptions
IllegalArgumentException:
The date is null or the period or the number of occurrences is negative.
See Also
addNotification(String, String, Object, Date, long, long)
addNotificationback to summary
public synchronized Integer addNotification(String type, String message, Object userData, Date date, long period, long nbOccurences) throws IllegalArgumentException

Implements javax.management.timer.TimerMBean.addNotification.

Creates a new timer notification with the specified type, message and userData and inserts it into the list of notifications with a given date, period and number of occurrences.

If the timer notification to be inserted has a date that is before the current date, the method behaves as if the specified date were the current date.
For once-off notifications, the notification is delivered immediately.
For periodic notifications, the first notification is delivered immediately and the subsequent ones are spaced as specified by the period parameter.

Note that once the timer notification has been added into the list of notifications, its associated date, period and number of occurrences cannot be updated.

In the case of a periodic notification, uses a fixed-delay execution scheme, as specified in java.util.Timer. In order to use a fixed-rate execution scheme, use addNotification(String, String, Object, Date, long, long, boolean) instead.

Parameters
type:String

The timer notification type.

message:String

The timer notification detailed message.

userData:Object

The timer notification user data object.

date:Date

The date when the notification occurs.

period:long

The period of the timer notification (in milliseconds).

nbOccurences:long

The total number the timer notification will be emitted.

Returns:Integer

The identifier of the new created timer notification.

Exceptions
IllegalArgumentException:
The date is null or the period or the number of occurrences is negative.
See Also
addNotification(String, String, Object, Date, long, long, boolean)
addNotificationback to summary
public synchronized Integer addNotification(String type, String message, Object userData, Date date, long period) throws IllegalArgumentException

Implements javax.management.timer.TimerMBean.addNotification.

Creates a new timer notification with the specified type, message and userData and inserts it into the list of notifications with a given date and period and a null number of occurrences.

The timer notification will repeat continuously using the timer period using a fixed-delay execution scheme, as specified in java.util.Timer. In order to use a fixed-rate execution scheme, use addNotification(String, String, Object, Date, long, long, boolean) instead.

If the timer notification to be inserted has a date that is before the current date, the method behaves as if the specified date were the current date. The first notification is delivered immediately and the subsequent ones are spaced as specified by the period parameter.

Parameters
type:String

The timer notification type.

message:String

The timer notification detailed message.

userData:Object

The timer notification user data object.

date:Date

The date when the notification occurs.

period:long

The period of the timer notification (in milliseconds).

Returns:Integer

The identifier of the new created timer notification.

Exceptions
IllegalArgumentException:
The date is null or the period is negative.
addNotificationback to summary
public synchronized Integer addNotification(String type, String message, Object userData, Date date) throws IllegalArgumentException

Implements javax.management.timer.TimerMBean.addNotification.

Creates a new timer notification with the specified type, message and userData and inserts it into the list of notifications with a given date and a null period and number of occurrences.

The timer notification will be handled once at the specified date.

If the timer notification to be inserted has a date that is before the current date, the method behaves as if the specified date were the current date and the notification is delivered immediately.

Parameters
type:String

The timer notification type.

message:String

The timer notification detailed message.

userData:Object

The timer notification user data object.

date:Date

The date when the notification occurs.

Returns:Integer

The identifier of the new created timer notification.

Exceptions
IllegalArgumentException:
The date is null.
getAllNotificationIDsback to summary
public synchronized Vector<Integer> getAllNotificationIDs()

Implements javax.management.timer.TimerMBean.getAllNotificationIDs.

Gets all timer notification identifiers registered into the list of notifications.

Returns:Vector<Integer>

A vector of Integer objects containing all the timer notification identifiers.
The vector is empty if there is no timer notification registered for this timer MBean.

getDateback to summary
public synchronized Date getDate(Integer id)

Implements javax.management.timer.TimerMBean.getDate.

Gets a copy of the date associated to a timer notification.

Parameters
id:Integer

The timer notification identifier.

Returns:Date

A copy of the date or null if the identifier is not mapped to any timer notification registered for this timer MBean.

getFixedRateback to summary
public synchronized Boolean getFixedRate(Integer id)

Implements javax.management.timer.TimerMBean.getFixedRate.

Gets a copy of the flag indicating whether a periodic notification is executed at fixed-delay or at fixed-rate.

Parameters
id:Integer

The timer notification identifier.

Returns:Boolean

A copy of the flag indicating whether a periodic notification is executed at fixed-delay or at fixed-rate.

getNbNotificationsback to summary
public synchronized int getNbNotifications()

Implements javax.management.timer.TimerMBean.getNbNotifications.

Gets the number of timer notifications registered into the list of notifications.

Returns:int

The number of timer notifications.

getNbOccurencesback to summary
public synchronized Long getNbOccurences(Integer id)

Implements javax.management.timer.TimerMBean.getNbOccurences.

Gets a copy of the remaining number of occurrences associated to a timer notification.

Parameters
id:Integer

The timer notification identifier.

Returns:Long

A copy of the remaining number of occurrences or null if the identifier is not mapped to any timer notification registered for this timer MBean.

getNotificationIDsback to summary
public synchronized Vector<Integer> getNotificationIDs(String type)

Implements javax.management.timer.TimerMBean.getNotificationIDs.

Gets all the identifiers of timer notifications corresponding to the specified type.

Parameters
type:String

The timer notification type.

Returns:Vector<Integer>

A vector of Integer objects containing all the identifiers of timer notifications with the specified type.
The vector is empty if there is no timer notifications registered for this timer MBean with the specified type.

getNotificationInfoback to summary
public synchronized MBeanNotificationInfo[] getNotificationInfo()

Overrides javax.management.NotificationBroadcasterSupport.getNotificationInfo.

Implements javax.management.NotificationBroadcaster.getNotificationInfo.

Doc from javax.management.NotificationBroadcaster.getNotificationInfo.

Returns an array indicating, for each notification this MBean may send, the name of the Java class of the notification and the notification type.

It is not illegal for the MBean to send notifications not described in this array. However, some clients of the MBean server may depend on the array being complete for their correct functioning.

getNotificationMessageback to summary
public synchronized String getNotificationMessage(Integer id)

Implements javax.management.timer.TimerMBean.getNotificationMessage.

Gets the timer notification detailed message corresponding to the specified identifier.

Parameters
id:Integer

The timer notification identifier.

Returns:String

The timer notification detailed message or null if the identifier is not mapped to any timer notification registered for this timer MBean.

getNotificationTypeback to summary
public synchronized String getNotificationType(Integer id)

Implements javax.management.timer.TimerMBean.getNotificationType.

Gets the timer notification type corresponding to the specified identifier.

Parameters
id:Integer

The timer notification identifier.

Returns:String

The timer notification type or null if the identifier is not mapped to any timer notification registered for this timer MBean.

getNotificationUserDataback to summary
public synchronized Object getNotificationUserData(Integer id)

Implements javax.management.timer.TimerMBean.getNotificationUserData.

Gets the timer notification user data object corresponding to the specified identifier.

Parameters
id:Integer

The timer notification identifier.

Returns:Object

The timer notification user data object or null if the identifier is not mapped to any timer notification registered for this timer MBean.

getPeriodback to summary
public synchronized Long getPeriod(Integer id)

Implements javax.management.timer.TimerMBean.getPeriod.

Gets a copy of the period (in milliseconds) associated to a timer notification.

Parameters
id:Integer

The timer notification identifier.

Returns:Long

A copy of the period or null if the identifier is not mapped to any timer notification registered for this timer MBean.

getSendPastNotificationsback to summary
public boolean getSendPastNotifications()

Implements javax.management.timer.TimerMBean.getSendPastNotifications.

Gets the flag indicating whether or not the timer sends past notifications.
The default value of the past notifications sending on/off flag is false.

Returns:boolean

The past notifications sending on/off flag value.

See Also
setSendPastNotifications
isActiveback to summary
public boolean isActive()

Implements javax.management.timer.TimerMBean.isActive.

Tests whether the timer MBean is active. A timer MBean is marked active when the start method is called. It becomes inactive when the stop method is called.
The default value of the active on/off flag is false.

Returns:boolean

true if the timer MBean is active, false otherwise.

isEmptyback to summary
public synchronized boolean isEmpty()

Implements javax.management.timer.TimerMBean.isEmpty.

Tests whether the list of timer notifications is empty.

Returns:boolean

true if the list of timer notifications is empty, false otherwise.

notifyAlarmClockback to summary
pack-priv void notifyAlarmClock(TimerAlarmClockNotification notification)

This method is called by the timer each time the TimerAlarmClock has exceeded its timeout.

Parameters
notification:TimerAlarmClockNotification

The TimerAlarmClock notification.

postDeregisterback to summary
public void postDeregister()

Implements javax.management.MBeanRegistration.postDeregister.

Allows the timer MBean to perform any operations needed after having been unregistered by the MBean server.

Not used in this context.

postRegisterback to summary
public void postRegister(Boolean registrationDone)

Implements javax.management.MBeanRegistration.postRegister.

Allows the timer MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.

Not used in this context.

preDeregisterback to summary
public void preDeregister() throws Exception

Implements javax.management.MBeanRegistration.preDeregister.

Allows the timer MBean to perform any operations it needs before being unregistered by the MBean server.

Stops the timer.

Exceptions
Exception:
if something goes wrong
preRegisterback to summary
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception

Implements javax.management.MBeanRegistration.preRegister.

Allows the timer MBean to perform any operations it needs before being registered in the MBean server.

Not used in this context.

Parameters
server:MBeanServer

The MBean server in which the timer MBean will be registered.

name:ObjectName

The object name of the timer MBean.

Returns:ObjectName

The name of the timer MBean registered.

Exceptions
Exception:
if something goes wrong
removeAllNotificationsback to summary
public synchronized void removeAllNotifications()

Implements javax.management.timer.TimerMBean.removeAllNotifications.

Removes all the timer notifications from the list of notifications and resets the counter used to update the timer notification identifiers.

removeNotificationback to summary
public synchronized void removeNotification(Integer id) throws InstanceNotFoundException

Implements javax.management.timer.TimerMBean.removeNotification.

Removes the timer notification corresponding to the specified identifier from the list of notifications.

Parameters
id:Integer

The timer notification identifier.

Exceptions
InstanceNotFoundException:
The specified identifier does not correspond to any timer notification in the list of notifications of this timer MBean.
removeNotificationsback to summary
public synchronized void removeNotifications(String type) throws InstanceNotFoundException

Implements javax.management.timer.TimerMBean.removeNotifications.

Removes all the timer notifications corresponding to the specified type from the list of notifications.

Parameters
type:String

The timer notification type.

Exceptions
InstanceNotFoundException:
The specified type does not correspond to any timer notification in the list of notifications of this timer MBean.
sendNotificationback to summary
pack-priv void sendNotification(Date timeStamp, TimerNotification notification)

This method is used by the timer MBean to update and send a timer notification to all the listeners registered for this kind of notification.

Parameters
timeStamp:Date

The notification emission date.

notification:TimerNotification

The timer notification to send.

sendPastNotificationsback to summary
private synchronized void sendPastNotifications(Date currentDate, boolean currentFlag)

Sends or not past notifications depending on the specified flag.

Parameters
currentDate:Date

The current date.

currentFlag:boolean

The flag indicating if past notifications must be sent or not.

setSendPastNotificationsback to summary
public void setSendPastNotifications(boolean value)

Implements javax.management.timer.TimerMBean.setSendPastNotifications.

Sets the flag indicating whether the timer sends past notifications or not.
The default value of the past notifications sending on/off flag is false.

Parameters
value:boolean

The past notifications sending on/off flag value.

See Also
getSendPastNotifications
startback to summary
public synchronized void start()

Implements javax.management.timer.TimerMBean.start.

Starts the timer.

If there is one or more timer notifications before the time in the list of notifications, the notification is sent according to the sendPastNotifications flag and then, updated according to its period and remaining number of occurrences. If the timer notification date remains earlier than the current date, this notification is just removed from the list of notifications.

stopback to summary
public synchronized void stop()

Implements javax.management.timer.TimerMBean.stop.

Stops the timer.

updateTimerTableback to summary
private synchronized void updateTimerTable(Integer notifID)

If the timer notification is not periodic, it is removed from the list of notifications.

If the timer period of the timer notification has a non null periodicity, the date of the timer notification is updated by adding the periodicity. The associated TimerAlarmClock is updated by setting its timeout to the period value.

If the timer period has a defined number of occurrences, the timer notification is updated if the number of occurrences has not yet been reached. Otherwise it is removed from the list of notifications.

Parameters
notifID:Integer

The timer notification identifier to update.