|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.management.NotificationBroadcasterSupport javax.management.timer.Timer
The timer service.
Field Summary | |
static long |
ONE_DAY
The number of milliseconds in one day. |
static long |
ONE_HOUR
The number of milliseconds in one hour. |
static long |
ONE_MINUTE
The number of milliseconds in one minute. |
static long |
ONE_SECOND
The number of milliseconds in one second. |
static long |
ONE_WEEK
The number of milliseconds in one week. |
Constructor Summary | |
Timer()
|
Method Summary | |
Integer |
addNotification(String type,
String message,
Object userData,
Date date)
Creates a new timer notification for a specific date/time. |
Integer |
addNotification(String type,
String message,
Object userData,
Date date,
long period)
Creates a new timer notification for a specific date/time, with an optional repeat period. |
Integer |
addNotification(String type,
String message,
Object userData,
Date date,
long period,
long occurences)
Creates a new timer notification for a specific date/time, with an optional repeat period and a maximum number of occurences. |
Integer |
addNotification(String type,
String message,
Object userData,
Date date,
long period,
long nbOccurences,
boolean fixedRate)
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 occurences. |
Vector |
getAllNotificationIDs()
Retrieves all timer notifications ids. |
Date |
getDate(Integer id)
Retrieves a copy of the notification date for a passed notification id. |
Boolean |
getFixedRate(Integer id)
Gets a copy of the flag indicating whether a peridic notification is executed at fixed-delay or at fixed-rate. |
int |
getNbNotifications()
Retrieves the number of registered timer notifications. |
Long |
getNbOccurences(Integer id)
Retrieves a copy of the maximum notification occurences for a passed notification id. |
Vector |
getNotificationIDs(String type)
Retrieves all timer notifications ids of the passed notification type. |
String |
getNotificationMessage(Integer id)
Retrieves the notification message for a passed notification id. |
String |
getNotificationType(Integer id)
Retrieves the notification type for a passed notification id. |
Object |
getNotificationUserData(Integer id)
Retrieves the notification user data for a passed notification id. |
Long |
getPeriod(Integer id)
Retrieves a copy of the notification period for a passed notification id. |
boolean |
getSendPastNotifications()
Retrieves the flag indicating whether past notifications are sent. |
boolean |
isActive()
Test whether the timer MBean is active. |
boolean |
isEmpty()
Test whether the timer MBean has any registered notifications. |
void |
postDeregister()
This method is called by the MBeanServer after deregistration takes place. |
void |
postRegister(Boolean registrationDone)
This method is called by the MBeanServer after registration takes place or when registration fails. |
void |
preDeregister()
This method is called by the MBeanServer before deregistration takes place. |
ObjectName |
preRegister(MBeanServer server,
ObjectName objectName)
This method is called by the MBeanServer before registration takes place. |
void |
removeAllNotifications()
Removes all notifications from the timer MBean. |
void |
removeNotification(Integer id)
Removes a notification from the timer MBean with the specified notification id. |
void |
removeNotifications(String type)
Removes all notifications from the timer MBean of the specified notification type. |
void |
setSendPastNotifications(boolean value)
Sets the flag indicating whether past notifications are sent. |
void |
start()
Starts the timer. |
void |
stop()
Stops the timer. |
Methods inherited from class javax.management.NotificationBroadcasterSupport |
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final long ONE_SECOND
public static final long ONE_MINUTE
public static final long ONE_HOUR
public static final long ONE_DAY
public static final long ONE_WEEK
Constructor Detail |
public Timer()
Method Detail |
public Integer addNotification(String type, String message, Object userData, Date date) throws IllegalArgumentException
TimerMBean
addNotification
in interface TimerMBean
type
- the notification type.message
- the notification's message string.userData
- the notification's user data.date
- the date/time the notification will occur.
IllegalArgumentException
- when the date is before the current
date.public Integer addNotification(String type, String message, Object userData, Date date, long period) throws IllegalArgumentException
TimerMBean
If the date and time is before the the current date and time the period is repeatedly added until a date after the current date and time is found.
addNotification
in interface TimerMBean
type
- the notification type.message
- the notification's message string.userData
- the notification's user data.date
- the date/time the notification will occur.period
- the repeat period in milli-seconds. Passing zero means
no repeat.
IllegalArgumentException
- when the date is before the current
date or the period is negative.public Integer addNotification(String type, String message, Object userData, Date date, long period, long occurences) throws IllegalArgumentException
TimerMBean
If the date and time is before the the current date and time the period is repeatedly added until a date after the current date and time is found. If the number of occurences is exceeded before the current date and time is reached, an IllegalArgumentException is raised.
addNotification
in interface TimerMBean
type
- the notification type.message
- the notification's message string.userData
- the notification's user data.date
- the date/time the notification will occur.period
- the repeat period in milli-seconds. Passing zero means
no repeat.occurences
- the maximum number of repeats. When the period is not
zero and this parameter is zero, it will repeat indefinitely.
IllegalArgumentException
- when the date is before the current
date, the period is negative or the number of repeats is
negative.public Vector getAllNotificationIDs()
TimerMBean
getAllNotificationIDs
in interface TimerMBean
public Date getDate(Integer id)
TimerMBean
getDate
in interface TimerMBean
id
- the notification id.
public int getNbNotifications()
TimerMBean
getNbNotifications
in interface TimerMBean
public Long getNbOccurences(Integer id)
TimerMBean
getNbOccurences
in interface TimerMBean
id
- the notification id.
public Boolean getFixedRate(Integer id)
getFixedRate
in interface TimerMBean
id
- The timer notification identifier.
public Vector getNotificationIDs(String type)
TimerMBean
getNotificationIDs
in interface TimerMBean
type
- the notification type.
public String getNotificationMessage(Integer id)
TimerMBean
getNotificationMessage
in interface TimerMBean
id
- the notification id.
public String getNotificationType(Integer id)
TimerMBean
getNotificationType
in interface TimerMBean
id
- the notification id.
public Object getNotificationUserData(Integer id)
TimerMBean
getNotificationUserData
in interface TimerMBean
id
- the notification id.
public Long getPeriod(Integer id)
TimerMBean
getPeriod
in interface TimerMBean
id
- the notification id.
public boolean getSendPastNotifications()
TimerMBean
getSendPastNotifications
in interface TimerMBean
public boolean isActive()
TimerMBean
isActive
in interface TimerMBean
public boolean isEmpty()
TimerMBean
isEmpty
in interface TimerMBean
public void removeAllNotifications()
TimerMBean
removeAllNotifications
in interface TimerMBean
public void removeNotification(Integer id) throws InstanceNotFoundException
TimerMBean
removeNotification
in interface TimerMBean
id
- the notification id.
InstanceNotFoundException
- when there are no notification
registered with the id passed.public void removeNotifications(String type) throws InstanceNotFoundException
TimerMBean
removeNotifications
in interface TimerMBean
type
- the notification type.
InstanceNotFoundException
- when there are no notifications of
the type passed.public void setSendPastNotifications(boolean value)
TimerMBean
setSendPastNotifications
in interface TimerMBean
value
- the new value of the flag. true when past notifications
are sent, false otherwise.public void start()
TimerMBean
start
in interface TimerMBean
public void stop()
TimerMBean
stop
in interface TimerMBean
public Integer addNotification(String type, String message, Object userData, Date date, long period, long nbOccurences, boolean fixedRate) throws IllegalArgumentException
addNotification
in interface TimerMBean
type
- The timer notification type.message
- The timer notification detailed message.userData
- The timer notification user data object.date
- The date when the notification occurs.period
- The period of the timer notification (in milliseconds).nbOccurences
- The total number the timer notification will be emitted.fixedRate
- 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.
IllegalArgumentException
- The period or the number of occurences is negativepublic ObjectName preRegister(MBeanServer server, ObjectName objectName) throws Exception
MBeanRegistration
The MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.
preRegister
in interface MBeanRegistration
Exception
- for any error, the MBean is not registered.public void postRegister(Boolean registrationDone)
MBeanRegistration
postRegister
in interface MBeanRegistration
registrationDone
- the MBeanServer passes true when the
MBean was registered, false otherwise.public void preDeregister() throws Exception
MBeanRegistration
The MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.
preDeregister
in interface MBeanRegistration
Exception
public void postDeregister()
MBeanRegistration
postDeregister
in interface MBeanRegistration
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |