|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
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。
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。