|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.management.NotificationBroadcasterSupport
org.jboss.mx.timer.JBossTimer
public class JBossTimer
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.
Timer
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 | |
---|---|
JBossTimer()
|
Method Summary | |
---|---|
Integer |
addNotification(String type,
String message,
Object userData,
Date date)
|
Integer |
addNotification(String type,
String message,
Object userData,
Date date,
long period)
|
Integer |
addNotification(String type,
String message,
Object userData,
Date date,
long period,
long 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()
|
Date |
getDate(Integer 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()
|
Long |
getNbOccurences(Integer id)
|
Vector |
getNotificationIDs(String type)
|
String |
getNotificationMessage(Integer id)
|
String |
getNotificationType(Integer id)
|
Object |
getNotificationUserData(Integer id)
|
Long |
getPeriod(Integer id)
|
boolean |
getSendPastNotifications()
|
boolean |
isActive()
|
boolean |
isEmpty()
|
void |
postDeregister()
|
void |
postRegister(Boolean registrationDone)
|
void |
preDeregister()
|
ObjectName |
preRegister(MBeanServer server,
ObjectName objectName)
|
void |
removeAllNotifications()
|
void |
removeNotification(Integer id)
|
void |
removeNotifications(String type)
|
void |
setSendPastNotifications(boolean value)
|
void |
start()
|
void |
stop()
|
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 JBossTimer()
Method Detail |
---|
public Integer addNotification(String type, String message, Object userData, Date date) throws IllegalArgumentException
addNotification
in interface TimerMBean
IllegalArgumentException
public Integer addNotification(String type, String message, Object userData, Date date, long period) throws IllegalArgumentException
addNotification
in interface TimerMBean
IllegalArgumentException
public Integer addNotification(String type, String message, Object userData, Date date, long period, long occurences) throws IllegalArgumentException
addNotification
in interface TimerMBean
IllegalArgumentException
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 Vector getAllNotificationIDs()
getAllNotificationIDs
in interface TimerMBean
public Date getDate(Integer id)
getDate
in interface TimerMBean
public int getNbNotifications()
getNbNotifications
in interface TimerMBean
public Long getNbOccurences(Integer id)
getNbOccurences
in interface TimerMBean
public Boolean getFixedRate(Integer id)
getFixedRate
in interface TimerMBean
id
- The timer notification identifier.
public Vector getNotificationIDs(String type)
getNotificationIDs
in interface TimerMBean
public String getNotificationMessage(Integer id)
getNotificationMessage
in interface TimerMBean
public String getNotificationType(Integer id)
getNotificationType
in interface TimerMBean
public Object getNotificationUserData(Integer id)
getNotificationUserData
in interface TimerMBean
public Long getPeriod(Integer id)
getPeriod
in interface TimerMBean
public boolean getSendPastNotifications()
getSendPastNotifications
in interface TimerMBean
public boolean isActive()
isActive
in interface TimerMBean
public boolean isEmpty()
isEmpty
in interface TimerMBean
public void removeAllNotifications()
removeAllNotifications
in interface TimerMBean
public void removeNotification(Integer id) throws InstanceNotFoundException
removeNotification
in interface TimerMBean
InstanceNotFoundException
public void removeNotifications(String type) throws InstanceNotFoundException
removeNotifications
in interface TimerMBean
InstanceNotFoundException
public void setSendPastNotifications(boolean value)
setSendPastNotifications
in interface TimerMBean
public void start()
start
in interface TimerMBean
public void stop()
stop
in interface TimerMBean
public ObjectName preRegister(MBeanServer server, ObjectName objectName) throws Exception
preRegister
in interface MBeanRegistration
Exception
public void postRegister(Boolean registrationDone)
postRegister
in interface MBeanRegistration
public void preDeregister() throws Exception
preDeregister
in interface MBeanRegistration
Exception
public void postDeregister()
postDeregister
in interface MBeanRegistration
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |