public static final class ExecutorScheduler.ExecutorWorker extends Scheduler.Worker implements Runnable
Constructor and Description |
---|
ExecutorWorker(Executor executor) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Dispose the resource, the operation should be idempotent.
|
boolean |
isDisposed()
Returns true if this resource has been disposed.
|
void |
run() |
Disposable |
schedule(Runnable run)
Schedules a Runnable for execution without any time delay.
|
Disposable |
schedule(Runnable run,
long delay,
TimeUnit unit)
Schedules an Runnable for execution at some point in the future specified by a time delay
relative to the current time.
|
now, schedulePeriodically
public ExecutorWorker(Executor executor)
@NonNull public Disposable schedule(@NonNull Runnable run)
Scheduler.Worker
The default implementation delegates to Scheduler.Worker.schedule(Runnable, long, TimeUnit)
.
schedule
in class Scheduler.Worker
run
- Runnable to schedule@NonNull public Disposable schedule(@NonNull Runnable run, long delay, @NonNull TimeUnit unit)
Scheduler.Worker
Note to implementors: non-positive delayTime
should be regarded as non-delayed schedule, i.e.,
as if the Scheduler.Worker.schedule(Runnable)
was called.
schedule
in class Scheduler.Worker
run
- the Runnable to scheduledelay
- time to "wait" before executing the action; non-positive values indicate an non-delayed
scheduleunit
- the time unit of delayTime
public void dispose()
Disposable
dispose
in interface Disposable
public boolean isDisposed()
Disposable
isDisposed
in interface Disposable
Copyright © 2019. All rights reserved.