public class NewThreadWorker extends Scheduler.Worker implements Disposable
| Constructor and Description |
|---|
NewThreadWorker(java.util.concurrent.ThreadFactory threadFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Dispose the resource, the operation should be idempotent.
|
Disposable |
schedule(java.lang.Runnable run) |
Disposable |
schedule(java.lang.Runnable action,
long delayTime,
java.util.concurrent.TimeUnit unit) |
ScheduledRunnable |
scheduleActual(java.lang.Runnable run,
long delayTime,
java.util.concurrent.TimeUnit unit,
CompositeResource<Disposable> parent)
Wraps the given runnable into a ScheduledRunnable and schedules it
on the underlying ScheduledExecutorService.
|
Disposable |
scheduleDirect(java.lang.Runnable run,
long delayTime,
java.util.concurrent.TimeUnit unit)
Schedules the given runnable on the underlying executor directly and
returns its future wrapped into a Disposable.
|
Disposable |
schedulePeriodicallyDirect(java.lang.Runnable run,
long initialDelay,
long period,
java.util.concurrent.TimeUnit unit)
Schedules the given runnable periodically on the underlying executor directly
and returns its future wrapped into a Disposable.
|
now, schedulePeriodicallypublic NewThreadWorker(java.util.concurrent.ThreadFactory threadFactory)
public Disposable schedule(java.lang.Runnable run)
schedule in class Scheduler.Workerpublic Disposable schedule(java.lang.Runnable action, long delayTime, java.util.concurrent.TimeUnit unit)
schedule in class Scheduler.Workerpublic Disposable scheduleDirect(java.lang.Runnable run, long delayTime, java.util.concurrent.TimeUnit unit)
run - delayTime - unit - public Disposable schedulePeriodicallyDirect(java.lang.Runnable run, long initialDelay, long period, java.util.concurrent.TimeUnit unit)
run - initialDelay - period - unit - public ScheduledRunnable scheduleActual(java.lang.Runnable run, long delayTime, java.util.concurrent.TimeUnit unit, CompositeResource<Disposable> parent)
If the schedule has been rejected, the ScheduledRunnable.wasScheduled will return false.
run - the runnable instancedelayTime - the time to delay the executionunit - the time unitparent - the optional tracker parent to add the created ScheduledRunnable instance to before it gets scheduledpublic void dispose()
Disposabledispose in interface Disposable