com.caucho.util
Class AlarmClock
java.lang.Object
com.caucho.util.AlarmClock
public class AlarmClock
- extends java.lang.Object
The alarm class provides a lightweight event scheduler. This allows
an objects to schedule a timeout without creating a new thread.
A separate thread periodically tests the queue for alarms ready.
Method Summary |
long |
extractAlarm(long now,
boolean isTest)
Returns the next alarm ready to run |
boolean |
queueAt(Alarm alarm,
long wakeTime)
Queue the alarm for wakeup. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
AlarmClock
public AlarmClock()
queueAt
public boolean queueAt(Alarm alarm,
long wakeTime)
- Queue the alarm for wakeup.
- Parameters:
delta
- time in milliseconds to wake
extractAlarm
public long extractAlarm(long now,
boolean isTest)
- Returns the next alarm ready to run
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object