| Modifier and Type | Class and Description |
|---|---|
| pack-priv class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv long | counter
The per-scheduler global order counter. |
| pack-priv final Queue | queue
The ordered queue for the runnable tasks. |
| pack-priv volatile long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | TestScheduler(long
the point in time to move the Scheduler's clock to delayTime, TimeUnit the units of time that unit)delayTime is expressed inCreates a new TestScheduler with the specified initial virtual time. |
| Modifier and Type | Method and Description |
|---|---|
| public void | advanceTimeBy(long
the amount of time to move the Scheduler's clock forward delayTime, TimeUnit the units of time that unit)delayTime is expressed inMoves the Scheduler's clock forward by a specified amount of time. |
| public void | advanceTimeTo(long
the point in time to move the Scheduler's clock to delayTime, TimeUnit the units of time that unit)delayTime is expressed inMoves the Scheduler's clock to a particular moment in time. |
| public Scheduler. | createWorker()
Implements abstract io. Scheduler. that represents sequential execution of actions.
|
| public long | now(TimeUnit
the time unit unit)Overrides io. |
| public void | triggerActions()
Triggers any actions that have not yet been triggered and that are scheduled to be triggered at or before this Scheduler's present time. |
| private void |
| counter | back to summary |
|---|---|
| pack-priv long counter The per-scheduler global order counter. | |
| queue | back to summary |
|---|---|
| pack-priv final Queue<TestScheduler. The ordered queue for the runnable tasks. | |
| time | back to summary |
|---|---|
| pack-priv volatile long time | |
| TestScheduler | back to summary |
|---|---|
| public TestScheduler() Creates a new TestScheduler with initial virtual time of zero. | |
| TestScheduler | back to summary |
|---|---|
| public TestScheduler(long delayTime, TimeUnit unit) Creates a new TestScheduler with the specified initial virtual time.
| |
| advanceTimeBy | back to summary |
|---|---|
| public void advanceTimeBy(long delayTime, TimeUnit unit) Moves the Scheduler's clock forward by a specified amount of time.
| |
| advanceTimeTo | back to summary |
|---|---|
| public void advanceTimeTo(long delayTime, TimeUnit unit) Moves the Scheduler's clock to a particular moment in time.
| |
| createWorker | back to summary |
|---|---|
| public Scheduler. Implements abstract io. Doc from io. Retrieves or creates a new
When work is completed, the
Work on a | |
| now | back to summary |
|---|---|
| public long now(TimeUnit unit) Overrides io. Doc from io. Returns the 'current time' of the Scheduler in the specified time unit. | |
| triggerActions | back to summary |
|---|---|
| public void triggerActions() Triggers any actions that have not yet been triggered and that are scheduled to be triggered at or before this Scheduler's present time. | |
| triggerActions | back to summary |
|---|---|
| private void triggerActions(long targetTimeInNanoseconds) | |
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv volatile boolean |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | dispose()
Implements io. |
| public boolean | isDisposed()
Implements io. |
| public long | now(TimeUnit
the time unit unit)Overrides io. |
| public Disposable | schedule(Runnable
the Runnable to schedule run, long time to "wait" before executing the action; non-positive values indicate an non-delayed
schedule delayTime, TimeUnit the time unit of unit)delayTimeImplements abstract io. |
| public Disposable | schedule(Runnable
Runnable to schedule run)Overrides io. |
| disposed | back to summary |
|---|---|
| pack-priv volatile boolean disposed | |
| TestWorker | back to summary |
|---|---|
| pack-priv TestWorker() | |
| dispose | back to summary |
|---|---|
| public void dispose() Implements io. Doc from io. Dispose the resource, the operation should be idempotent.
| |
| isDisposed | back to summary |
|---|---|
| public boolean isDisposed() Implements io. Doc from io. Returns true if this resource has been disposed.
| |
| now | back to summary |
|---|---|
| public long now(TimeUnit unit) Overrides io. Doc from io. Returns the 'current time' of the Worker in the specified time unit. | |
| schedule | back to summary |
|---|---|
| public Disposable schedule(Runnable run, long delayTime, TimeUnit unit) Implements abstract io. Doc from io. Schedules an Runnable for execution at some point in the future specified by a time delay relative to the current time.
Note to implementors: non-positive
| |
| schedule | back to summary |
|---|---|
| public Disposable schedule(Runnable run) Overrides io. Doc from io. Schedules a Runnable for execution without any time delay. The default implementation delegates to
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final TestScheduler. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| timedAction | back to summary |
|---|---|
| pack-priv final TestScheduler. | |
| QueueRemove | back to summary |
|---|---|
| pack-priv QueueRemove(TestScheduler. | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final long | |
| pack-priv final Runnable | |
| pack-priv final TestScheduler. | |
| pack-priv final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | compareTo(TestScheduler.
the object to be compared. oImplements java. |
| public String |
| count | back to summary |
|---|---|
| pack-priv final long count | |
| run | back to summary |
|---|---|
| pack-priv final Runnable run | |
| scheduler | back to summary |
|---|---|
| pack-priv final TestScheduler. | |
| time | back to summary |
|---|---|
| pack-priv final long time | |
| TimedRunnable | back to summary |
|---|---|
| pack-priv TimedRunnable(TestScheduler. | |
| compareTo | back to summary |
|---|---|
| public int compareTo(TestScheduler. Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |