Top Fields Constructors Methods
reactor.core.scheduler

pack-priv final Class ExecutorServiceWorker

extends Object
implements Worker, Disposable, Scannable
Class Inheritance
All Implemented Interfaces
reactor.core.Scannable, reactor.core.Disposable, reactor.core.scheduler.Scheduler.Worker
Imports
java.util.concurrent.ScheduledExecutorService, .TimeUnit, reactor.core.Disposable, .Disposables, .Scannable

Author
Stephane Maldini

Field Summary

Modifier and TypeField and Description
pack-priv final Disposable.Composite
disposables

Cleanup tasks to be performed when this worker is disposed, including but not limited to tasks that have been scheduled on the worker.

pack-priv final ScheduledExecutorService
exec

The ScheduledExecutorService that backs this worker (can be shared)

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements reactor.core.Disposable.dispose.

Cancel or dispose the underlying task or resource.
public boolean
isDisposed()

Overrides default reactor.core.Disposable.isDisposed.

Optionally return true when the resource or task is disposed.
public Object
scanUnsafe(Scannable.Attr<T>
a Attr to resolve for the component.
key
)

Implements reactor.core.Scannable.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place.
public Disposable
schedule(Runnable
the task to schedule
task
)

Implements reactor.core.scheduler.Scheduler.Worker.schedule.

Schedules the task for immediate execution on this worker.
public Disposable
schedule(Runnable
the task to schedule
task
,
long
the delay amount, non-positive values indicate non-delayed scheduling
delay
,
TimeUnit
the unit of measure of the delay amount
unit
)

Overrides default reactor.core.scheduler.Scheduler.Worker.schedule.

Schedules the execution of the given task with the given delay amount.
public Disposable
schedulePeriodically(Runnable
the task to schedule
task
,
long
the initial delay amount, non-positive values indicate non-delayed scheduling
initialDelay
,
long
the period at which the task should be re-executed
period
,
TimeUnit
the unit of measure of the delay amount
unit
)

Overrides default reactor.core.scheduler.Scheduler.Worker.schedulePeriodically.

Schedules a periodic execution of the given task with the given initial delay and period.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

disposablesback to summary
pack-priv final Disposable.Composite disposables

Cleanup tasks to be performed when this worker is disposed, including but not limited to tasks that have been scheduled on the worker.

execback to summary
pack-priv final ScheduledExecutorService exec

The ScheduledExecutorService that backs this worker (can be shared)

Constructor Detail

ExecutorServiceWorkerback to summary
pack-priv ExecutorServiceWorker(ScheduledExecutorService exec)

Method Detail

disposeback to summary
public void dispose()

Implements reactor.core.Disposable.dispose.

Doc from reactor.core.Disposable.dispose.

Cancel or dispose the underlying task or resource.

Implementations are required to make this method idempotent.

Annotations
@Override
isDisposedback to summary
public boolean isDisposed()

Overrides default reactor.core.Disposable.isDisposed.

Doc from reactor.core.Disposable.isDisposed.

Optionally return true when the resource or task is disposed.

Implementations are not required to track disposition and as such may never return true even when disposed. However, they MUST only return true when there's a guarantee the resource or task is disposed.

Returns:boolean

true when there's a guarantee the resource or task is disposed.

Annotations
@Override
scanUnsafeback to summary
public Object scanUnsafe(Scannable.Attr<T> key)

Implements reactor.core.Scannable.scanUnsafe.

Doc from reactor.core.Scannable.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place. Although it is ignoring the generic type of the Attr key, implementors should take care to return values of the correct type, and return null if no specific value is available.

For public consumption of attributes, prefer using scan(Attr), which will return a typed value and fall back to the key's default if the component didn't define any mapping.

Parameters
key:Scannable.Attr<T>

a Attr to resolve for the component.

Returns:Object

the value associated to the key for that specific component, or null if none.

Annotations
@Override
scheduleback to summary
public Disposable schedule(Runnable task)

Implements reactor.core.scheduler.Scheduler.Worker.schedule.

Doc from reactor.core.scheduler.Scheduler.Worker.schedule.

Schedules the task for immediate execution on this worker.

Parameters
task:Runnable

the task to schedule

Returns:Disposable

the Disposable instance that let's one cancel this particular task. If the Scheduler has been shut down, a RejectedExecutionException is thrown.

Annotations
@Override
scheduleback to summary
public Disposable schedule(Runnable task, long delay, TimeUnit unit)

Overrides default reactor.core.scheduler.Scheduler.Worker.schedule.

Doc from reactor.core.scheduler.Scheduler.Worker.schedule.

Schedules the execution of the given task with the given delay amount.

This method is safe to be called from multiple threads and tasks are executed in some total order. Two tasks scheduled at a same time with the same delay will be ordered in FIFO order if the schedule() was called from the same thread or in arbitrary order if the schedule() was called from different threads.

Parameters
task:Runnable

the task to schedule

delay:long

the delay amount, non-positive values indicate non-delayed scheduling

unit:TimeUnit

the unit of measure of the delay amount

Returns:Disposable

the Disposable that let's one cancel this particular delayed task, or throw a RejectedExecutionException if the Worker is not capable of scheduling with delay.

Annotations
@Override
schedulePeriodicallyback to summary
public Disposable schedulePeriodically(Runnable task, long initialDelay, long period, TimeUnit unit)

Overrides default reactor.core.scheduler.Scheduler.Worker.schedulePeriodically.

Doc from reactor.core.scheduler.Scheduler.Worker.schedulePeriodically.

Schedules a periodic execution of the given task with the given initial delay and period.

This method is safe to be called from multiple threads.

The periodic execution is at a fixed rate, that is, the first execution will be after the initial delay, the second after initialDelay + period, the third after initialDelay + 2 * period, and so on.

Parameters
task:Runnable

the task to schedule

initialDelay:long

the initial delay amount, non-positive values indicate non-delayed scheduling

period:long

the period at which the task should be re-executed

unit:TimeUnit

the unit of measure of the delay amount

Returns:Disposable

the Disposable that let's one cancel this particular delayed task, or throw a RejectedExecutionException if the Worker is not capable of scheduling periodically.

Annotations
@Override