Class ScheduledRunnable

java.lang.Object
java.util.concurrent.atomic.AtomicReferenceArray<Object>
io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable
All Implemented Interfaces:
Disposable, Serializable, Runnable, Callable<Object>

public final class ScheduledRunnable extends AtomicReferenceArray<Object> implements Runnable, Callable<Object>, Disposable
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • actual

      final Runnable actual
    • interruptOnCancel

      final boolean interruptOnCancel
    • PARENT_DISPOSED

      static final Object PARENT_DISPOSED
      Indicates that the parent tracking this task has been notified about its completion.
    • SYNC_DISPOSED

      static final Object SYNC_DISPOSED
      Indicates the dispose() was called from within the run/call method.
    • ASYNC_DISPOSED

      static final Object ASYNC_DISPOSED
      Indicates the dispose() was called from another thread.
    • DONE

      static final Object DONE
    • PARENT_INDEX

      static final int PARENT_INDEX
      See Also:
    • FUTURE_INDEX

      static final int FUTURE_INDEX
      See Also:
    • THREAD_INDEX

      static final int THREAD_INDEX
      See Also:
  • Constructor Details

    • ScheduledRunnable

      public ScheduledRunnable(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(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 none
      interruptOnCancel - if true, the underlying future will be interrupted when disposing this task from a different thread than it is running on.
  • Method Details

    • call

      public Object call()
      Specified by:
      call in interface Callable<Object>
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • setFuture

      public void setFuture(Future<?> f)
    • dispose

      public void dispose()
      Description copied from interface: Disposable
      Dispose the resource, the operation should be idempotent.
      Specified by:
      dispose in interface Disposable
    • isDisposed

      public boolean isDisposed()
      Description copied from interface: Disposable
      Returns true if this resource has been disposed.
      Specified by:
      isDisposed in interface Disposable
      Returns:
      true if this resource has been disposed
    • toString

      public String toString()
      Overrides:
      toString in class AtomicReferenceArray<Object>