public interface TimerMBean
| Modifier and Type | Method and Description |
|---|---|
Integer |
addNotification(String type, String message, Object userData, Date date)
创建具有
type
message和
userData的新定时器通知,
message其插入具有给定日期的通知列表,并显示空值和发生次数。
|
Integer |
addNotification(String type, String message, Object userData, Date date, long period)
创建具有指定的新计时器通知
type ,
message和
userData并将其插入到带有给定日期和时段,以及null出现数量的通知列表中。
|
Integer |
addNotification(String type, String message, Object userData, Date date, long period, long nbOccurences)
创建具有指定的新计时器通知
type ,
message和
userData并将其插入到与事件的定日期,时段和数量的通知列表中。
|
Integer |
addNotification(String type, String message, Object userData, Date date, long period, long nbOccurences, boolean fixedRate)
创建具有
type
message和
userData的新定时器通知,并将
userData插入到具有给定日期,周期和出现次数的通知列表中。
|
Vector<Integer> |
getAllNotificationIDs()
获取注册到通知列表中的所有定时器通知标识符。
|
Date |
getDate(Integer id)
获取与定时器通知相关联的日期的副本。
|
Boolean |
getFixedRate(Integer id)
获取标志的副本,指示是定期通知是以
固定延迟还是
固定速率执行 。
|
int |
getNbNotifications()
获取注册到通知列表中的定时器通知的数量。
|
Long |
getNbOccurences(Integer id)
获取与定时器通知相关联的剩余发生次数的副本。
|
Vector<Integer> |
getNotificationIDs(String type)
获取与指定类型相对应的定时器通知的所有标识符。
|
String |
getNotificationMessage(Integer id)
获取与指定标识符相对应的定时器通知详细消息。
|
String |
getNotificationType(Integer id)
获取与指定标识符对应的定时器通知类型。
|
Object |
getNotificationUserData(Integer id)
获取与指定标识符相对应的定时器通知用户数据对象。
|
Long |
getPeriod(Integer id)
获取与定时器通知相关联的周期(以毫秒为单位)的副本。
|
boolean |
getSendPastNotifications()
获取指示定时器是否发送过去通知的标志。
|
boolean |
isActive()
测试定时器MBean是否处于活动状态。
|
boolean |
isEmpty()
测试定时器通知的列表是否为空。
|
void |
removeAllNotifications()
从通知列表中删除所有定时器通知,并重置用于更新计时器通知标识符的计数器。
|
void |
removeNotification(Integer id)
从通知列表中删除与指定标识符相对应的定时器通知。
|
void |
removeNotifications(String type)
从通知列表中删除与指定类型对应的所有定时器通知。
|
void |
setSendPastNotifications(boolean value)
设置指示定时器是否发送过去通知的标志。
|
void |
start()
启动计时器。
|
void |
stop()
停止定时器
|
void start()
如果在通知列表中的时间之前有一个或多个定时器通知,则根据sendPastNotifications标志发送通知,然后根据其周期和剩余发生次数进行更新。 如果计时器通知日期早于当前日期,则此通知将从通知列表中移除。
void stop()
Integer addNotification(String type, String message, Object userData, Date date, long period, long nbOccurences, boolean fixedRate) throws IllegalArgumentException
type , message和userData并将其插入到与事件的定日期,时段和数量的通知列表中。
如果要插入的计时器通知的日期在当前日期之前,该方法的行为就像指定的日期是当前日期一样。
对于一次性通知,通知将立即发送。
对于定期通知,第一个通知立即发送,后续的通知按照period参数指定。
请注意,一旦定时器通知已添加到通知列表中,则无法更新其关联的日期,周期和出现次数。
在周期性通知的情况下,参数固定利率的值用于指定执行方案,如在指定的Timer 。
type - 定时器通知类型。
message - 定时器通知详细信息。
userData - 定时器通知用户数据对象。
date - 发生
date的日期。
period - 定时器通知的周期(以毫秒为单位)。
nbOccurences - 将发出定时器通知的总数。
fixedRate - 如果true并且如果通知是周期性的,则以固定速率执行方案调度通知。
如果false并且如果通知是周期性的,则以固定延迟执行方案调度通知。
如果通知不是周期性的,则忽略。
IllegalArgumentException - 日期为
null或期间或出现次数为负。
addNotification(String, String, Object, Date, long, long)
Integer addNotification(String type, String message, Object userData, Date date, long period, long nbOccurences) throws IllegalArgumentException
type , message和userData并将其插入到与事件的定日期,时段和数量的通知列表中。
如果要插入的计时器通知的日期在当前日期之前,该方法的行为就像指定的日期是当前日期一样。
对于一次性通知,通知将立即发送。
对于定期通知,第一个通知立即发送,后续的通知按照period参数指定。
请注意,一旦定时器通知已添加到通知列表中,则无法更新其关联的日期,周期和出现次数。
在周期性通知的情况下,使用固定的延迟执行方案,如在指定的Timer 。 为了使用固定速率执行方案,请改用addNotification(String, String, Object, Date, long, long, boolean) 。
type - 定时器通知类型。
message - 定时器通知详细信息。
userData - 定时器通知用户数据对象。
date - 发生
date的日期。
period - 定时器通知的周期(以毫秒为单位)。
nbOccurences - 将发出定时器通知的总数。
IllegalArgumentException - 日期为
null或期间或出现次数为负数。
addNotification(String, String, Object, Date, long, long, boolean)
Integer addNotification(String type, String message, Object userData, Date date, long period) throws IllegalArgumentException
type message和userData的新计时器通知, message其插入具有给定日期和时间段的通知列表中,并且出现零次数。
使用固定延迟执行方案,定时器通知将使用定时器周期连续重复,如Timer 所述 。 为了使用固定速率执行方案,请改用addNotification(String, String, Object, Date, long, long, boolean) 。
如果要插入的计时器通知的日期在当前日期之前,该方法的行为就像指定的日期是当前日期一样。 第一个通知立即发送,随后的通知按照period参数指定。
type - 定时器通知类型。
message - 定时器通知详细信息。
userData - 定时器通知用户数据对象。
date - 发生
date的日期。
period - 定时器通知的周期(以毫秒为单位)。
IllegalArgumentException - 日期为
null或期间为负。
Integer addNotification(String type, String message, Object userData, Date date) throws IllegalArgumentException
type , message和userData并将其插入到与事件给定日期以及null时段和数量的通知列表中。
计时器通知将在指定的日期处理一次。
如果要插入的计时器通知的日期在当前日期之前,该方法的行为就像指定的日期是当前日期一样,并且立即发送通知。
type - 定时器通知类型。
message - 定时器通知详细信息。
userData - 定时器通知用户数据对象。
date - 发生
date的日期。
IllegalArgumentException - 日期是
null 。
void removeNotification(Integer id) throws InstanceNotFoundException
id - 定时器通知标识符。
InstanceNotFoundException - 指定的标识符与此定时器MBean的通知列表中的任何定时器通知不对应。
void removeNotifications(String type) throws InstanceNotFoundException
type - 定时器通知类型。
InstanceNotFoundException - 指定的类型与此定时器MBean的通知列表中的任何定时器通知不对应。
void removeAllNotifications()
int getNbNotifications()
Vector<Integer> getAllNotificationIDs()
Integer对象的向量。
Vector<Integer> getNotificationIDs(String type)
type - 定时器通知类型。
Integer对象的矢量, Integer具有指定的定时器通知的所有标识符type 。
type 。
String getNotificationType(Integer id)
id - 定时器通知标识符。
String getNotificationMessage(Integer id)
id - 定时器通知标识符。
Object getNotificationUserData(Integer id)
id - 定时器通知标识符。
Date getDate(Integer id)
id - 定时器通知标识符。
Long getPeriod(Integer id)
id - 定时器通知标识符。
Long getNbOccurences(Integer id)
id - 定时器通知标识符。
Boolean getFixedRate(Integer id)
id - 定时器通知标识符。
boolean getSendPastNotifications()
setSendPastNotifications(boolean)
void setSendPastNotifications(boolean value)
value - 过去的通知发送开/关标志值。
getSendPastNotifications()
boolean isActive()
true如果计时器MBean处于活动状态,
false false。
boolean isEmpty()
true if the list of timer notifications is empty,
false otherwise.
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.