public final class TrampolineScheduler extends Scheduler
Scheduler.Worker
Modifier and Type | Method and Description |
---|---|
Scheduler.Worker |
createWorker()
Retrieves or creates a new
Scheduler.Worker that represents sequential execution of actions. |
static TrampolineScheduler |
instance() |
Disposable |
scheduleDirect(Runnable run)
Schedules the given task on this Scheduler without any time delay.
|
Disposable |
scheduleDirect(Runnable run,
long delay,
TimeUnit unit)
Schedules the execution of the given task with the given time delay.
|
clockDriftTolerance, now, schedulePeriodicallyDirect, shutdown, start, when
public static TrampolineScheduler instance()
@NonNull public Scheduler.Worker createWorker()
Scheduler
Scheduler.Worker
that represents sequential execution of actions.
When work is completed, the Worker
instance should be released
by calling Disposable.dispose()
to avoid potential resource leaks in the
underlying task-execution scheme.
Work on a Scheduler.Worker
is guaranteed to be sequential and non-overlapping.
createWorker
in class Scheduler
@NonNull public Disposable scheduleDirect(@NonNull Runnable run)
Scheduler
This method is safe to be called from multiple threads but there are no ordering or non-overlapping guarantees between tasks.
scheduleDirect
in class Scheduler
run
- the task to execute@NonNull public Disposable scheduleDirect(@NonNull Runnable run, long delay, TimeUnit unit)
Scheduler
This method is safe to be called from multiple threads but there are no ordering guarantees between tasks.
scheduleDirect
in class Scheduler
run
- the task to scheduledelay
- the delay amount, non-positive values indicate non-delayed schedulingunit
- the unit of measure of the delay amountCopyright © 2018 JBoss by Red Hat. All rights reserved.