Class ScheduledRunnable
- java.lang.Object
-
- java.util.concurrent.atomic.AtomicReferenceArray<java.lang.Object>
-
- io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable
-
- All Implemented Interfaces:
Disposable,java.io.Serializable,java.lang.Runnable,java.util.concurrent.Callable<java.lang.Object>
public final class ScheduledRunnable extends java.util.concurrent.atomic.AtomicReferenceArray<java.lang.Object> implements java.lang.Runnable, java.util.concurrent.Callable<java.lang.Object>, Disposable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.Runnableactual(package private) static java.lang.ObjectASYNC_DISPOSEDIndicates the dispose() was called from another thread.(package private) static java.lang.ObjectDONE(package private) static intFUTURE_INDEX(package private) booleaninterruptOnCancel(package private) static java.lang.ObjectPARENT_DISPOSEDIndicates that the parent tracking this task has been notified about its completion.(package private) static intPARENT_INDEXprivate static longserialVersionUID(package private) static java.lang.ObjectSYNC_DISPOSEDIndicates the dispose() was called from within the run/call method.(package private) static intTHREAD_INDEX
-
Constructor Summary
Constructors Constructor Description ScheduledRunnable(java.lang.Runnable actual, DisposableContainer parent)Creates a ScheduledRunnable by wrapping the given action and setting up the optional parent.ScheduledRunnable(java.lang.Runnable actual, DisposableContainer parent, boolean interruptOnCancel)Creates a ScheduledRunnable by wrapping the given action and setting up the optional parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectcall()voiddispose()Dispose the resource, the operation should be idempotent.booleanisDisposed()Returns true if this resource has been disposed.voidrun()voidsetFuture(java.util.concurrent.Future<?> f)java.lang.StringtoString()-
Methods inherited from class java.util.concurrent.atomic.AtomicReferenceArray
accumulateAndGet, compareAndExchange, compareAndExchangeAcquire, compareAndExchangeRelease, compareAndSet, get, getAcquire, getAndAccumulate, getAndSet, getAndUpdate, getOpaque, getPlain, lazySet, length, set, setOpaque, setPlain, setRelease, updateAndGet, weakCompareAndSet, weakCompareAndSetAcquire, weakCompareAndSetPlain, weakCompareAndSetRelease, weakCompareAndSetVolatile
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
actual
final java.lang.Runnable actual
-
interruptOnCancel
final boolean interruptOnCancel
-
PARENT_DISPOSED
static final java.lang.Object PARENT_DISPOSED
Indicates that the parent tracking this task has been notified about its completion.
-
SYNC_DISPOSED
static final java.lang.Object SYNC_DISPOSED
Indicates the dispose() was called from within the run/call method.
-
ASYNC_DISPOSED
static final java.lang.Object ASYNC_DISPOSED
Indicates the dispose() was called from another thread.
-
DONE
static final java.lang.Object DONE
-
PARENT_INDEX
static final int PARENT_INDEX
- See Also:
- Constant Field Values
-
FUTURE_INDEX
static final int FUTURE_INDEX
- See Also:
- Constant Field Values
-
THREAD_INDEX
static final int THREAD_INDEX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ScheduledRunnable
public ScheduledRunnable(java.lang.Runnable actual, DisposableContainer parent)Creates a ScheduledRunnable by wrapping the given action and setting up the optional parent. The underlying future will be interrupted if the task is disposed asynchronously.- Parameters:
actual- the runnable to wrap, not-null (not verified)parent- the parent tracking container or null if none
-
ScheduledRunnable
public ScheduledRunnable(java.lang.Runnable actual, DisposableContainer parent, boolean interruptOnCancel)Creates a ScheduledRunnable by wrapping the given action and setting up the optional parent.- Parameters:
actual- the runnable to wrap, not-null (not verified)parent- the parent tracking container or null if noneinterruptOnCancel- if true, the underlying future will be interrupted when disposing this task from a different thread than it is running on.
-
-
Method Detail
-
call
public java.lang.Object call()
- Specified by:
callin interfacejava.util.concurrent.Callable<java.lang.Object>
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
setFuture
public void setFuture(java.util.concurrent.Future<?> f)
-
dispose
public void dispose()
Description copied from interface:DisposableDispose the resource, the operation should be idempotent.- Specified by:
disposein interfaceDisposable
-
isDisposed
public boolean isDisposed()
Description copied from interface:DisposableReturns true if this resource has been disposed.- Specified by:
isDisposedin interfaceDisposable- Returns:
- true if this resource has been disposed
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.util.concurrent.atomic.AtomicReferenceArray<java.lang.Object>
-
-