|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectseda.sandStorm.core.ssTimer
The ssTimer class provides a mechanism for registering timer events that will go off at some future time. The future time can be specified in absolute or relative terms. When the timer goes off, an element is placed on a queue. There is no way to unregister a timer. Events will be delivered guaranteed, but the time that they are delivered may slip depending on stuff like how loaded the system is and all that.
WARNING: you should use cancelEvent to cancel timers that you no longer need, otherwise you will waste many, many cycles on unneeded timer firings. This was the bottleneck in vSpace and the DDS before we fixed it. For example, if you set a timer to go off on a cross-CPU task to detect failure, then if the task returns successfully, cancel the timer!
Nested Class Summary | |
static class |
ssTimer.ssTimerEvent
|
Constructor Summary | |
ssTimer()
|
Method Summary | |
void |
cancelAll()
Cancels all events. |
void |
cancelEvent(ssTimer.ssTimerEvent evt)
Cancels the firing of this timer event. |
void |
doneWithTimer()
Kills off this timer object, dropping all pending events on floor. |
static void |
main(java.lang.String[] args)
|
int |
profileSize()
Return the profile size of this timer. |
ssTimer.ssTimerEvent |
registerEvent(java.util.Date the_date,
QueueElementIF obj,
SinkIF queue)
Object obj will be placed on SinkIF queue
no earlier than absolute time the_date . |
ssTimer.ssTimerEvent |
registerEvent(long millis,
QueueElementIF obj,
SinkIF queue)
Object obj will be placed on SinkIF queue
no earlier than millis milliseconds from now. |
void |
run()
|
int |
size()
How many events yet to fire? |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ssTimer()
Method Detail |
public ssTimer.ssTimerEvent registerEvent(long millis, QueueElementIF obj, SinkIF queue)
obj
will be placed on SinkIF queue
no earlier than millis
milliseconds from now.
millis
- the number of milliseconds from now when the event will
take placeobj
- the object that will be placed on the queuequeue
- the queue on which the object will be placedpublic ssTimer.ssTimerEvent registerEvent(java.util.Date the_date, QueueElementIF obj, SinkIF queue)
obj
will be placed on SinkIF queue
no earlier than absolute time the_date
.
the_date
- the date when the event will take place - if this date
is in the past, the event will happen right awayobj
- the object that will be placed on the queuequeue
- the queue on which the object will be placedpublic void doneWithTimer()
public int size()
public int profileSize()
profileSize
in interface ProfilableIF
public void cancelAll()
public void cancelEvent(ssTimer.ssTimerEvent evt)
evt
- the ssTimer.ssTimerEvent to cancel. This ssTimerEvent
is returned to you when you call registerEventpublic void run()
run
in interface java.lang.Runnable
public static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |