Scheduler which uses a backing ExecutorService to schedule
Runnables for async operators. This scheduler is time-capable (can schedule with a
delay and/or periodically) if the backing executor is a ScheduledExecutorService.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final String | |
| pack-priv final ScheduledExecutorService | |
| pack-priv volatile SchedulerState | |
| pack-priv static final AtomicReferenceFieldUpdater | |
| pack-priv static final ScheduledExecutorService |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | await(ScheduledExecutorService resource, long timeout, TimeUnit timeUnit)
Implements reactor. |
| pack-priv static ScheduledExecutorService | |
| public Scheduler. | createWorker()
Implements reactor. |
| public void | dispose()
Overrides default reactor. |
| public Mono | disposeGracefully()
Overrides default reactor. dispose() that also allows for graceful cleanup
of underlying resources.
|
| pack-priv ScheduledExecutorService | |
| public void | init()
Overrides default reactor. Workers.
|
| public boolean | isDisposed()
Overrides default reactor. |
| public Object | scanUnsafe(Scannable.
a keyAttr to resolve for the component.Implements reactor. |
| public Disposable | schedule(Runnable
the task to execute task)Implements reactor. |
| 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. |
| 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. |
| public void | start()
Overrides default reactor. |
| public String |
| executorName | back to summary |
|---|---|
| pack-priv final String executorName | |
| original | back to summary |
|---|---|
| pack-priv final ScheduledExecutorService original | |
| state | back to summary |
|---|---|
| pack-priv volatile SchedulerState<ScheduledExecutorService> state
| |
| STATE | back to summary |
|---|---|
pack-priv static final AtomicReferenceFieldUpdater<DelegateServiceScheduler, SchedulerState<T>> STATE
| |
| TERMINATED | back to summary |
|---|---|
| pack-priv static final ScheduledExecutorService TERMINATED | |
| DelegateServiceScheduler | back to summary |
|---|---|
| pack-priv DelegateServiceScheduler(String executorName, ExecutorService executorService) | |
| await | back to summary |
|---|---|
| public boolean await(ScheduledExecutorService resource, long timeout, TimeUnit timeUnit) throws InterruptedException Implements reactor.
| |
| convert | back to summary |
|---|---|
pack-priv static ScheduledExecutorService convert(ExecutorService executor)
| |
| createWorker | back to summary |
|---|---|
| public Scheduler. Implements reactor. Doc from reactor. 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 | |
| dispose | back to summary |
|---|---|
| public void dispose() Overrides default reactor. Doc from reactor. 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 | back to summary |
|---|---|
| public Mono Overrides default reactor. Doc from reactor. Lazy variant of It is advised to apply a The returned | |
| getOrCreate | back to summary |
|---|---|
| pack-priv ScheduledExecutorService getOrCreate() | |
| init | back to summary |
|---|---|
| public void init() Overrides default reactor. Doc from reactor. Instructs this Scheduler to prepare itself for running tasks
directly or through its Implementations are encouraged to throw an exception if this method is called
after the scheduler has been disposed via
| |
| isDisposed | back to summary |
|---|---|
| public boolean isDisposed() Overrides default reactor. Doc from reactor. 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.
| |
| scanUnsafe | back to summary |
|---|---|
| public Object scanUnsafe(Scannable. Implements reactor. Doc from reactor. 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
For public consumption of attributes, prefer using | |
| schedule | back to summary |
|---|---|
| public Disposable schedule(Runnable task) Implements reactor. Doc from reactor. 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.
| |
| schedule | back to summary |
|---|---|
| public Disposable schedule(Runnable task, long delay, TimeUnit unit) Overrides default reactor. Doc from reactor. 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.
| |
| schedulePeriodically | back to summary |
|---|---|
| public Disposable schedulePeriodically(Runnable task, long initialDelay, long period, TimeUnit unit) Overrides default reactor. Doc from reactor. 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.
| |
| start | back to summary |
|---|---|
| public void start() Overrides default reactor. Doc from reactor. Instructs this Scheduler to prepare itself for running tasks directly or through its Workers. The operation is thread-safe but one should avoid using start() and dispose() concurrently as it would non-deterministically leave the Scheduler in either active or inactive state.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final ExecutorService |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | awaitTermination(long
the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. |
| public void | execute(Runnable
the runnable task command)Implements java. |
| public ExecutorService | |
| public <T> List | invokeAll(Collection<? extends Callable<T>>
the collection of tasks tasks)Implements java. |
| public <T> List | invokeAll(Collection<? extends Callable<T>>
the collection of tasks tasks, long the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. |
| public <T> T | invokeAny(Collection<? extends Callable<T>>
the collection of tasks tasks)Implements java. |
| public <T> T | invokeAny(Collection<? extends Callable<T>>
the collection of tasks tasks, long the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. |
| public boolean | isShutdown()
Implements java. true if this executor has been shut down.
|
| public boolean | isTerminated()
Implements java. true if all tasks have completed following shut down.
|
| public ScheduledFuture | schedule(Runnable
the task to execute command, long the time from now to delay execution delay, TimeUnit the time unit of the delay parameter unit)Implements java. |
| public <V> ScheduledFuture | schedule(Callable<V>
the function to execute callable, long the time from now to delay execution delay, TimeUnit the time unit of the delay parameter unit)Implements java. |
| public ScheduledFuture | scheduleAtFixedRate(Runnable
the task to execute command, long the time to delay first execution initialDelay, long the period between successive executions period, TimeUnit the time unit of the initialDelay and period parameters unit)Implements java. initialDelay, then initialDelay + period, then
initialDelay + 2 * period, and so on.
|
| public ScheduledFuture | scheduleWithFixedDelay(Runnable
the task to execute command, long the time to delay first execution initialDelay, long the delay between the termination of one
execution and the commencement of the next delay, TimeUnit the time unit of the initialDelay and delay parameters unit)Implements java. |
| public void | shutdown()
Implements java. |
| public List | shutdownNow()
Implements java. |
| public <T> Future | submit(Callable<T>
the task to submit task)Implements java. |
| public <T> Future | submit(Runnable
the task to submit task, T the result to return result)Implements java. |
| public Future | submit(Runnable
the task to submit task)Implements java. |
| public String |
| exec | back to summary |
|---|---|
| pack-priv final ExecutorService exec | |
| UnsupportedScheduledExecutorService | back to summary |
|---|---|
| pack-priv UnsupportedScheduledExecutorService(ExecutorService exec) | |
| awaitTermination | back to summary |
|---|---|
| public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException Implements java. Doc from java. Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
| |
| execute | back to summary |
|---|---|
| public void execute(Runnable command) Implements java. Doc from java. 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 | |
| get | back to summary |
|---|---|
| public ExecutorService get() Implements java. Doc from java. Gets a result.
| |
| invokeAll | back to summary |
|---|---|
| public <T> List Implements java. Doc from java. Executes the given tasks, returning a list of Futures holding
their status and results when all complete.
| |
| invokeAll | back to summary |
|---|---|
| public <T> List Implements java. Doc from java. Executes the given tasks, returning a list of Futures holding
their status and results
when all complete or the timeout expires, whichever happens first.
| |
| invokeAny | back to summary |
|---|---|
| public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException Implements java. Doc from java. Executes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do. Upon normal or exceptional return, tasks that have not completed are cancelled. The results of this method are undefined if the given collection is modified while this operation is in progress.
| |
| invokeAny | back to summary |
|---|---|
| public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException Implements java. Doc from java. Executes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do before the given timeout elapses. Upon normal or exceptional return, tasks that have not completed are cancelled. The results of this method are undefined if the given collection is modified while this operation is in progress.
| |
| isShutdown | back to summary |
|---|---|
| public boolean isShutdown() Implements java. Doc from java. Returns
| |
| isTerminated | back to summary |
|---|---|
| public boolean isTerminated() Implements java. Doc from java. Returns
| |
| schedule | back to summary |
|---|---|
| public ScheduledFuture Implements java. Doc from java. Submits a one-shot task that becomes enabled after the given delay.
| |
| schedule | back to summary |
|---|---|
| public <V> ScheduledFuture Implements java. Doc from java. Submits a value-returning one-shot task that becomes enabled after the given delay.
| |
| scheduleAtFixedRate | back to summary |
|---|---|
| public ScheduledFuture Implements java. Doc from java. Submits a periodic action that becomes enabled first after the
given initial delay, and subsequently with the given period;
that is, executions will commence after
The sequence of task executions continues indefinitely until one of the following exceptional completions occur:
isDone() on the returned future will
return true.
If any execution of this task takes longer than its period, then subsequent executions may start late, but will not concurrently execute.
| |
| scheduleWithFixedDelay | back to summary |
|---|---|
| public ScheduledFuture Implements java. Doc from java. Submits a periodic action that becomes enabled first after the given initial delay, and subsequently with the given delay between the termination of one execution and the commencement of the next. The sequence of task executions continues indefinitely until one of the following exceptional completions occur:
isDone() on the returned future will
return true.
| |
| shutdown | back to summary |
|---|---|
| public void shutdown() Implements java. Doc from java. Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down. This method does not wait for previously submitted tasks to
complete execution. Use
| |
| shutdownNow | back to summary |
|---|---|
| public List Implements java. Doc from java. Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution. This method does not wait for actively executing tasks to
terminate. Use There are no guarantees beyond best-effort attempts to stop
processing actively executing tasks. For example, typical
implementations will cancel via | |
| submit | back to summary |
|---|---|
| public <T> Future Implements java. Doc from java. Submits a value-returning task for execution and returns a
Future representing the pending results of the task. The
Future's
If you would like to immediately block waiting
for a task, you can use constructions of the form
Note The | |
| submit | back to summary |
|---|---|
| public <T> Future Implements java. Doc from java. Submits a Runnable task for execution and returns a Future
representing that task. The Future's | |
| submit | back to summary |
|---|---|
| public Future Implements java. Doc from java. Submits a Runnable task for execution and returns a Future
representing that task. The Future's | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |