|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.iids.aos.util.AlarmQueue
public class AlarmQueue
Class AlarmQueue is a thread-safe alarm queue. This queue can be used to wake up a thread at certain times. Alarms can be set when to wake up. This class is useful in a scenario when periodically certain tasks have to be done, but the time intervals tasks may be variable.
| Nested Class Summary | |
|---|---|
static class |
AlarmQueue.Alarm
This class represents an alarm. |
| Constructor Summary | |
|---|---|
AlarmQueue()
|
|
| Method Summary | |
|---|---|
void |
addAlarm(AlarmQueue.Alarm newAlarm)
|
void |
addAlarm(long time,
java.lang.Object id)
|
void |
removeAlarm(java.lang.Object id)
Remove an Alarm. |
AlarmQueue.Alarm |
waitForAlarm()
Find the next alarm that has gone off and return it This alarm will have been removed from the AlarmQueue. |
void |
waitForAlarms(java.util.List<AlarmQueue.Alarm> alarms)
Wait until the next alarm goes off. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AlarmQueue()
| Method Detail |
|---|
public void addAlarm(AlarmQueue.Alarm newAlarm)
public void addAlarm(long time,
java.lang.Object id)
public void removeAlarm(java.lang.Object id)
public AlarmQueue.Alarm waitForAlarm()
throws java.lang.InterruptedException
java.lang.InterruptedException
public void waitForAlarms(java.util.List<AlarmQueue.Alarm> alarms)
throws java.lang.InterruptedException
alarms - List will contain all alarms that have gone off
java.lang.InterruptedException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||