Top Description Fields Constructors Methods
reactor.core.scheduler

pack-priv final Class SingleWorkerScheduler

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

Wraps one of the workers of some other Scheduler and provides Worker services on top of it.

Use the dispose() to release the wrapped worker. This scheduler is time-capable if the worker itself is time-capable (can schedule with a delay and/or periodically).

Field Summary

Modifier and TypeField and Description
pack-priv final Scheduler.Worker

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Scheduler.Worker
createWorker()

Implements reactor.core.scheduler.Scheduler.createWorker.

Creates a worker of this Scheduler.
public void
dispose()

Overrides default reactor.core.scheduler.Scheduler.dispose.

Instructs this Scheduler to release all resources and reject any new tasks to be executed.
public void
execute(Runnable
the runnable task
command
)

Implements java.util.concurrent.Executor.execute.

Executes the given command at some time in the future.
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 execute
task
)

Implements reactor.core.scheduler.Scheduler.schedule.

Schedules the non-delayed execution of the given task on this scheduler.
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.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.schedulePeriodically.

Schedules a periodic execution of the given task with the given initial delay and period.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

mainback to summary
pack-priv final Scheduler.Worker main

Constructor Detail

SingleWorkerSchedulerback to summary
pack-priv SingleWorkerScheduler(Scheduler actual)

Method Detail

createWorkerback to summary
public Scheduler.Worker createWorker()

Implements reactor.core.scheduler.Scheduler.createWorker.

Doc from reactor.core.scheduler.Scheduler.createWorker.

Creates a worker of this Scheduler.

Once the Worker is no longer in use, one should call dispose() on it to release any resources the particular Scheduler may have used. It depends on the implementation, but Scheduler Workers should usually run tasks in FIFO order. Some implementations may entirely delegate the scheduling to an underlying structure (like an ExecutorService).

Returns:Scheduler.Worker

the Worker instance.

Annotations
@Override
disposeback to summary
public void dispose()

Overrides default reactor.core.scheduler.Scheduler.dispose.

Doc from reactor.core.scheduler.Scheduler.dispose.

Instructs this Scheduler to release all resources and reject any new tasks to be executed.

The operation is thread-safe.

The Scheduler may choose to ignore this instruction.

When used in combination with disposeGracefully() there are no guarantees that all resources will be forcefully shutdown. When a graceful disposal has started, the references to the underlying java.util.concurrent.Executors might have already been lost.

Annotations
@Override
executeback to summary
public void execute(Runnable command)

Implements java.util.concurrent.Executor.execute.

Doc from java.util.concurrent.Executor.execute.

Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the Executor implementation.

Parameters
command:Runnable

the runnable task

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.schedule.

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

Schedules the non-delayed execution of the given task on this scheduler.

This method is safe to be called from multiple threads but there are no ordering guarantees between tasks.

Parameters
task:Runnable

the task to execute

Returns:Disposable

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

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

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

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

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

This method is safe to be called from multiple threads but there are no ordering guarantees between tasks.

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 Scheduler 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.schedulePeriodically.

Doc from reactor.core.scheduler.Scheduler.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 but there are no ordering guarantees between tasks.

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 Scheduler is not capable of scheduling periodically.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override