Top Description Inners Fields Constructors Methods
reactor.core.scheduler

pack-priv final Class ImmediateScheduler

extends Object
implements Scheduler, Scannable
Class Inheritance
All Implemented Interfaces
reactor.core.Scannable, reactor.core.scheduler.Scheduler, reactor.core.Disposable
Imports
reactor.core.Disposable, .Disposables, .Exceptions, .Scannable

Executes tasks on the caller's thread immediately.

Use the ImmediateScheduler.instance() to get a shared, stateless instance of this scheduler. This scheduler is NOT time-capable (can't schedule with delay / periodically).

Author
Stephane Maldini

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv static final Disposable
private static final ImmediateScheduler

Constructor Summary

AccessConstructor and Description
private

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 static Scheduler
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.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FINISHEDback to summary
pack-priv static final Disposable FINISHED
INSTANCEback to summary
private static final ImmediateScheduler INSTANCE

Constructor Detail

ImmediateSchedulerback to summary
private ImmediateScheduler()

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
instanceback to summary
public static Scheduler instance()
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
reactor.core.scheduler back to summary

pack-priv final Class ImmediateScheduler.ImmediateSchedulerWorker

extends Object
implements Worker, Scannable
Class Inheritance
  • java.lang.Object
  • reactor.core.scheduler.ImmediateScheduler.ImmediateSchedulerWorker
All Implemented Interfaces
reactor.core.Scannable, reactor.core.scheduler.Scheduler.Worker, reactor.core.Disposable

Field Summary

Modifier and TypeField and Description
pack-priv volatile boolean

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.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

shutdownback to summary
pack-priv volatile boolean shutdown

Constructor Detail

ImmediateSchedulerWorkerback to summary
pack-priv ImmediateSchedulerWorker()

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