public interface TimerMBean
公开计时器 MBean 的管理接口。
| 方法摘要 | |
|---|---|
  Integer |  
     addNotification(String type, String message, Object userData, Date date) 创建具有指定 type、message 和 userData 的新计时器通知,并将其插入到带有给定日期以及 null 时段和出现数量的通知列表中。 |  
    
  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 的新计时器通知,并将其插入到带有给定日期、时段和出现数量的通知列表中。 |  
    
  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 参数指定的间隔提供。 
注意,一旦将计时器通知添加到通知列表中,将不能更新其相关的日期、时段和出现数量。
 如果是定期通知,则参数 fixedRate 的值将用来指定执行方案,如在 Timer 中指定的那样。 
type - 计时器通知类型。
     message - 计时器通知详细消息。
     userData - 计时器通知用户数据对象。
     date - 发出通知时的日期。
     period - 计时器通知的时段(以毫秒为单位)。
     nbOccurences - 将发出的计时器通知的总数。
     fixedRate - 如果为 
      true 并且通知是定期的,则使用
      固定速率 执行方案安排该通知。如果为 
      false 并且通知是定期的,则使用
      固定延迟 执行方案安排通知。如果通知不是定期的,则将被忽略。 
     IllegalArgumentException - 如果 date 为 
      null 或者 period 或出现的数量为负数。
     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 - 发出通知时的日期。
     period - 计时器通知的时段(以毫秒为单位)。
     nbOccurences - 将发出的计时器通知的总数。 
     IllegalArgumentException - 如果 date 为 
      null 或者 period 或出现的数量为负数。
     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 的新计时器通知,并将其插入到带有给定日期和时段,以及 null 出现数量的通知列表中。 
     通过使用固定延迟 执行方案,计时器通知将持续重复使用计时器时段,如在 Timer 中指定的那样。为了使用固定速率 执行方案,要使用 addNotification(String, String, Object, Date, long, long, boolean)。 
如果要插入的计时器通知其日期早于当前的日期,则该方法具有把指定的日期当做当前日期的行为。将立即发出第一个通知,而后续通知将根据 period 参数指定的间隔提供。
type - 计时器通知类型。
     message - 计时器通知详细消息。
     userData - 计时器通知用户数据对象。
     date - 发出通知时的日期。
     period - 计时器通知的时段(以毫秒为单位)。 
     IllegalArgumentException - 如果 date 为 
      null 或者 period 或出现的数量为负数。
     Integer addNotification(String type, String message, Object userData, Date date) throws IllegalArgumentException
type、
    message 和 
    userData 的新计时器通知,并将其插入到带有给定日期以及 null 时段和出现数量的通知列表中。 
    计时器通知将在指定的日期一次性处理。
如果要插入的计时器通知其日期早于当前的日期,则该方法具有把指定的日期当做当前日期的行为,并且将立即发出通知。
type - 计时器通知类型。
     message - 计时器通知详细消息。
     userData - 计时器通知用户数据对象。
     date - 发出通知时的日期。 
     IllegalArgumentException - 如果 date 为 
      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 对象的向量,该对象包含所有带指定 
      type 的计时器通知的标识符。
      type 的计时器 MBean 注册的计时器通知,则该向量为空。
     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()
start 方法时,计时器 MBean 被标记为激活。当调用 
    stop 方法时,该标记变为非激活。 
    
true;否则返回 
      false。
     boolean isEmpty()
true,否则返回 
      false。