|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.michab.simulator.Clock.ClockHandle
Each clock client receives a ClockHandle
as the result
of performing the register()
operation. This handle is
used for further communication with the clock. The client is
responsible to call prepare()
on the clock handle as soon
as it is ready to be scheduled.
prepare()
Method Summary | |
long |
advance(int ticks)
Advances the local time of this client for the given number of ticks. |
long |
currentLocalTime()
Returns the client's local time. |
long |
currentTime()
Returns the current time of the Clock |
void |
prepare()
Signals to the Clock that the calling thread is ready to
be scheduled. |
long |
reschedule()
Signals that the thread that is responsible for this handle is ready to be scheduled again. |
long |
stealTicks(int number)
experimental |
long |
unschedule()
Remove the calling thread from the list of threads that can be scheduled. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public void prepare()
Clock
that the calling thread is ready to
be scheduled. Actual scheduling for all registered Clock
clients is started by a call to Clock.start()
. As a
result each thread calling prepare()
is blocked until
scheduling is started.
public long advance(int ticks)
ticks
- The number of ticks to advance.
currentLocalTime()
but
prevents another call.
java.lang.IllegalArgumentException
- This is thrown if zero is passed.currentLocalTime()
public long stealTicks(int number)
number
- The number of ticks to steal.
public long unschedule() throws java.lang.InterruptedException
reschedule()
is called.
java.lang.InterruptedException
public long reschedule()
unschedule()
. Instead reschedule()
has to be
called from a different thread. The calling thread will not be blocked.
public long currentLocalTime()
advance()
also returns the local time.
advance(int)
public long currentTime()
Clock. This represents
overall clock time which is different and normally earlier than
the clock client's local time.
- Returns:
- The current clock time.
- See Also:
Clock.currentTime()
,
currentLocalTime()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |