javax.management.timer
Interface TimerMBean

All Known Implementing Classes:
Timer

public interface TimerMBean

The timer service MBean interface.

Version:
$Revision: 1.2 $
Author:
Adrian Brock

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.
 Vector getAllNotificationIDs()
          Retrieves all timer notifications ids.
 Date getDate(Integer id)
          Retrieves a copy of the notification date for a passed notification id.
 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 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.
 

Method Detail

addNotification

public Integer addNotification(String type,
                               String message,
                               Object userData,
                               Date date)
                        throws IllegalArgumentException
Creates a new timer notification for a specific date/time. The notification is performed once.

Parameters:
type - the notification type.
message - the notification's message string.
userData - the notification's user data.
date - the date/time the notification will occur.
Returns:
the notification id for this notification.
Throws:
IllegalArgumentException - when the date is before the current date.

addNotification

public Integer addNotification(String type,
                               String message,
                               Object userData,
                               Date date,
                               long period)
                        throws IllegalArgumentException
Creates a new timer notification for a specific date/time, with an optional repeat period. When the repeat period is not zero, the notification repeats forever.

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.

Parameters:
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.
Returns:
the notification id for this notification.
Throws:
IllegalArgumentException - when the date is before the current date or the period is negative.

addNotification

public Integer addNotification(String type,
                               String message,
                               Object userData,
                               Date date,
                               long period,
                               long occurences)
                        throws IllegalArgumentException
Creates a new timer notification for a specific date/time, with an optional repeat period and a maximum number of occurences.

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.

Parameters:
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.
Returns:
the notification id for this notification.
Throws:
IllegalArgumentException - when the date is before the current date, the period is negative or the number of repeats is negative.

getAllNotificationIDs

public Vector getAllNotificationIDs()
Retrieves all timer notifications ids.

Returns:
a vector of Integers containing the ids. The list is empty when there are no timer notifications.

getDate

public Date getDate(Integer id)
Retrieves a copy of the notification date for a passed notification id.

Parameters:
id - the notification id.
Returns:
a copy of the notification date or null when the notification id is not registered.

getNbNotifications

public int getNbNotifications()
Retrieves the number of registered timer notifications.

Returns:
the number of notifications.

getNbOccurences

public Long getNbOccurences(Integer id)
Retrieves a copy of the maximum notification occurences for a passed notification id.

Parameters:
id - the notification id.
Returns:
a copy of the maximum notification occurences or null when the notification id is not registered.

getNotificationIDs

public Vector getNotificationIDs(String type)
Retrieves all timer notifications ids of the passed notification type.

Parameters:
type - the notification type.
Returns:
a vector of Integers containing the ids. The list is empty when there are no timer notifications of the passed type.

getNotificationMessage

public String getNotificationMessage(Integer id)
Retrieves the notification message for a passed notification id.

Parameters:
id - the notification id.
Returns:
the notification message or null when the notification id is not registered.

getNotificationType

public String getNotificationType(Integer id)
Retrieves the notification type for a passed notification id.

Parameters:
id - the notification id.
Returns:
the notification type or null when the notification id is not registered.

getNotificationUserData

public Object getNotificationUserData(Integer id)
Retrieves the notification user data for a passed notification id.

Parameters:
id - the notification id.
Returns:
the notification user data or null when the notification id is not registered.

getPeriod

public Long getPeriod(Integer id)
Retrieves a copy of the notification period for a passed notification id.

Parameters:
id - the notification id.
Returns:
a copy of the notification period or null when the notification id is not registered.

getSendPastNotifications

public boolean getSendPastNotifications()
Retrieves the flag indicating whether past notifications are sent.

Returns:
true when past notifications are sent, false otherwise.

isActive

public boolean isActive()
Test whether the timer MBean is active.

Returns:
true when timer is active, false otherwise.

isEmpty

public boolean isEmpty()
Test whether the timer MBean has any registered notifications.

Returns:
true when timer has no registered notifications, false otherwise.

removeAllNotifications

public void removeAllNotifications()
Removes all notifications from the timer MBean.


removeNotification

public void removeNotification(Integer id)
                        throws InstanceNotFoundException
Removes a notification from the timer MBean with the specified notification id.

Parameters:
id - the notification id.
Throws:
InstanceNotFoundException - when there are no notification registered with the id passed.

removeNotifications

public void removeNotifications(String type)
                         throws InstanceNotFoundException
Removes all notifications from the timer MBean of the specified notification type.

Parameters:
type - the notification type.
Throws:
InstanceNotFoundException - when there are no notifications of the type passed.

setSendPastNotifications

public void setSendPastNotifications(boolean value)
Sets the flag indicating whether past notifications are sent.

Parameters:
value - the new value of the flag. true when past notifications are sent, false otherwise.

start

public void start()
Starts the timer. If there are any notifications before the current time these notifications are processed. The notification only takes place when send past notiications is true.


stop

public void stop()
Stops the timer.



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.