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.Runnable
actual
(package private) static java.lang.Object
ASYNC_DISPOSED
Indicates the dispose() was called from another thread.(package private) static java.lang.Object
DONE
(package private) static int
FUTURE_INDEX
(package private) boolean
interruptOnCancel
(package private) static java.lang.Object
PARENT_DISPOSED
Indicates that the parent tracking this task has been notified about its completion.(package private) static int
PARENT_INDEX
private static long
serialVersionUID
(package private) static java.lang.Object
SYNC_DISPOSED
Indicates the dispose() was called from within the run/call method.(package private) static int
THREAD_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.Object
call()
void
dispose()
Dispose the resource, the operation should be idempotent.boolean
isDisposed()
Returns true if this resource has been disposed.void
run()
void
setFuture(java.util.concurrent.Future<?> f)
java.lang.String
toString()
-
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:
call
in interfacejava.util.concurrent.Callable<java.lang.Object>
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
setFuture
public void setFuture(java.util.concurrent.Future<?> f)
-
dispose
public void dispose()
Description copied from interface:Disposable
Dispose the resource, the operation should be idempotent.- Specified by:
dispose
in interfaceDisposable
-
isDisposed
public boolean isDisposed()
Description copied from interface:Disposable
Returns true if this resource has been disposed.- Specified by:
isDisposed
in interfaceDisposable
- Returns:
- true if this resource has been disposed
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.concurrent.atomic.AtomicReferenceArray<java.lang.Object>
-
-