Top Description Fields Constructors Methods
reactor.core.scheduler

pack-priv final Class WorkerTask

extends Object
implements Runnable, Disposable, Callable<Void>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Callable, reactor.core.Disposable, java.lang.Runnable
Imports
java.util.concurrent.Callable, .Future, .FutureTask, java.util.concurrent.atomic.AtomicReferenceFieldUpdater, reactor.core.Disposable, reactor.util.annotation.Nullable

A runnable task for Scheduler Workers that are time-capable (implementing a relevant schedule(delay) and schedulePeriodically(period) methods). Unlike the one in DelegateServiceScheduler, this runnable doesn't expose the ability to cancel inner task when interrupted.
Authors
Simon Baslé, David Karnok

Field Summary

Modifier and TypeField and Description
pack-priv static final Future<Void>
ASYNC_CANCELLED

marker that the Worker was cancelled from another thread, making it safe to interrupt the Future task.

pack-priv static final Disposable.Composite
DISPOSED

marker that the Worker was disposed and the parent got notified

pack-priv static final Disposable.Composite
DONE

marker that the Worker has completed, for the PARENT field

pack-priv static final Future<Void>
FINISHED

marker that the Worker has completed, for the FUTURE field

pack-priv volatile Future<?>
pack-priv static final AtomicReferenceFieldUpdater<WorkerTask, Future<V>>
pack-priv volatile Disposable.Composite
pack-priv static final AtomicReferenceFieldUpdater<WorkerTask, Disposable.Composite>
pack-priv static final Future<Void>
SYNC_CANCELLED

marker that the Worker was cancelled from the same thread (ie.

pack-priv final Runnable
pack-priv volatile Thread
pack-priv static final AtomicReferenceFieldUpdater<WorkerTask, Thread>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Void
call()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.
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 void
run()

Implements java.lang.Runnable.run.

Runs this operation.
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ASYNC_CANCELLEDback to summary
pack-priv static final Future<Void> ASYNC_CANCELLED

marker that the Worker was cancelled from another thread, making it safe to interrupt the Future task.

DISPOSEDback to summary
pack-priv static final Disposable.Composite DISPOSED

marker that the Worker was disposed and the parent got notified

DONEback to summary
pack-priv static final Disposable.Composite DONE

marker that the Worker has completed, for the PARENT field

FINISHEDback to summary
pack-priv static final Future<Void> FINISHED

marker that the Worker has completed, for the FUTURE field

futureback to summary
pack-priv volatile Future<?> future
FUTUREback to summary
pack-priv static final AtomicReferenceFieldUpdater<WorkerTask, Future<V>> FUTURE
parentback to summary
pack-priv volatile Disposable.Composite parent
PARENTback to summary
pack-priv static final AtomicReferenceFieldUpdater<WorkerTask, Disposable.Composite> PARENT
SYNC_CANCELLEDback to summary
pack-priv static final Future<Void> SYNC_CANCELLED

marker that the Worker was cancelled from the same thread (ie. within call()/run()), which means setFuture might race: we avoid interrupting the Future in this case.

taskback to summary
pack-priv final Runnable task
threadback to summary
pack-priv volatile Thread thread
THREADback to summary
pack-priv static final AtomicReferenceFieldUpdater<WorkerTask, Thread> THREAD

Constructor Detail

WorkerTaskback to summary
pack-priv WorkerTask(Runnable task, Disposable.Composite parent)

Method Detail

callback to summary
public Void call()

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:Void

computed result

Annotations
@Override
@Nullable
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
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
setFutureback to summary
pack-priv void setFuture(Future<?> f)