| java.lang.Object javax.management.NotificationBroadcasterSupport org.jboss.mx.timer.JBossTimer
JBossTimer | public class JBossTimer extends NotificationBroadcasterSupport implements JBossTimerMBean,MBeanRegistration(Code) | | A clone of the JBossMX javax.management.timer.Timer service.
There are indications that the jdk5 javax.management.timer.Timer
uses internally a single-threaded implementation for executing
scheduled tasks, so scheduling of multiple tasks is affected
when moving from jdk1.4 and the jboss implementation of Timer,
to a jdk5 runtime.
The JBossMX Timer implementation in contrast uses a dynamically
extensible thread pool to execute scheduled tasks. Since we don't
control the jdk5 implementation, we've cloned the jboss timer
so it can be used as a drop-in replacement of the jdk JMX Timer.
The two classes *should* be kept in sync, or instead change our
javax.management.timer.Timer to delegate to this class.
See Also: javax.management.timer.Timer author: Adrian Brock author: Dimitris Andreadis version: $Revision: 57200 $ |
Field Summary | |
final public static long | ONE_DAY The number of milliseconds in one day. | final public static long | ONE_HOUR The number of milliseconds in one hour. | final public static long | ONE_MINUTE The number of milliseconds in one minute. | final public static long | ONE_SECOND The number of milliseconds in one second. | final public static long | ONE_WEEK The number of milliseconds in one week. | boolean | active Whether the service is active. | int | nextId The next notification id. | HashMap | notifications The registered notifications. | ObjectName | objectName Our object name. | boolean | sendPastNotifications The send past events attribute. | long | sequenceNumber The next notification sequence number. |
Method Summary | |
public Integer | addNotification(String type, String message, Object userData, Date date) | public Integer | addNotification(String type, String message, Object userData, Date date, long period) | public Integer | addNotification(String type, String message, Object userData, Date date, long period, long occurences) | public 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.
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 occurences 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 Timer.
Parameters: type - The timer notification type. Parameters: message - The timer notification detailed message. Parameters: userData - The timer notification user data object. Parameters: date - The date when the notification occurs. Parameters: period - The period of the timer notification (in milliseconds). Parameters: nbOccurences - The total number the timer notification will be emitted. Parameters: fixedRate - If true and if the notification is periodic, the notification is scheduled with a fixed-rate execution scheme. | public Vector | getAllNotificationIDs() | public Date | getDate(Integer id) | public Boolean | getFixedRate(Integer id) Gets a copy of the flag indicating whether a peridic notification is executed at fixed-delay or at fixed-rate.
Parameters: id - The timer notification identifier. | public int | getNbNotifications() | public Long | getNbOccurences(Integer id) | public Vector | getNotificationIDs(String type) | public String | getNotificationMessage(Integer id) | public String | getNotificationType(Integer id) | public Object | getNotificationUserData(Integer id) | public Long | getPeriod(Integer id) | public boolean | getSendPastNotifications() | public boolean | isActive() | public boolean | isEmpty() | public void | postDeregister() | public void | postRegister(Boolean registrationDone) | public void | preDeregister() | public ObjectName | preRegister(MBeanServer server, ObjectName objectName) | public void | removeAllNotifications() | public void | removeNotification(Integer id) | public void | removeNotifications(String type) | public void | setSendPastNotifications(boolean value) | public synchronized void | start() | public synchronized void | stop() |
ONE_DAY | final public static long ONE_DAY(Code) | | The number of milliseconds in one day.
|
ONE_HOUR | final public static long ONE_HOUR(Code) | | The number of milliseconds in one hour.
|
ONE_MINUTE | final public static long ONE_MINUTE(Code) | | The number of milliseconds in one minute.
|
ONE_SECOND | final public static long ONE_SECOND(Code) | | The number of milliseconds in one second.
|
ONE_WEEK | final public static long ONE_WEEK(Code) | | The number of milliseconds in one week.
|
active | boolean active(Code) | | Whether the service is active.
|
nextId | int nextId(Code) | | The next notification id.
|
notifications | HashMap notifications(Code) | | The registered notifications.
|
sendPastNotifications | boolean sendPastNotifications(Code) | | The send past events attribute.
|
sequenceNumber | long sequenceNumber(Code) | | The next notification sequence number.
|
addNotification | public Integer addNotification(String type, String message, Object userData, Date date, long period, long nbOccurences, boolean fixedRate) throws IllegalArgumentException(Code) | | 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.
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 occurences 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 Timer.
Parameters: type - The timer notification type. Parameters: message - The timer notification detailed message. Parameters: userData - The timer notification user data object. Parameters: date - The date when the notification occurs. Parameters: period - The period of the timer notification (in milliseconds). Parameters: nbOccurences - The total number the timer notification will be emitted. Parameters: 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. The identifier of the new created timer notification. throws: IllegalArgumentException - The period or the number of occurences is negative |
getAllNotificationIDs | public Vector getAllNotificationIDs()(Code) | | |
getFixedRate | public Boolean getFixedRate(Integer id)(Code) | | Gets a copy of the flag indicating whether a peridic notification is executed at fixed-delay or at fixed-rate.
Parameters: id - The timer notification identifier. A copy of the flag indicating whether a peridic notification is executed at fixed-delay or at fixed-rate. |
getNbNotifications | public int getNbNotifications()(Code) | | |
getSendPastNotifications | public boolean getSendPastNotifications()(Code) | | |
isActive | public boolean isActive()(Code) | | |
isEmpty | public boolean isEmpty()(Code) | | |
postDeregister | public void postDeregister()(Code) | | |
postRegister | public void postRegister(Boolean registrationDone)(Code) | | |
removeAllNotifications | public void removeAllNotifications()(Code) | | |
setSendPastNotifications | public void setSendPastNotifications(boolean value)(Code) | | |
start | public synchronized void start()(Code) | | |
stop | public synchronized void stop()(Code) | | |
|
|