Class ReferenceDisposable<T>

java.lang.Object
java.util.concurrent.atomic.AtomicReference<T>
io.reactivex.rxjava3.disposables.ReferenceDisposable<T>
Type Parameters:
T - the type contained
All Implemented Interfaces:
Disposable, Serializable
Direct Known Subclasses:
ActionDisposable, AutoCloseableDisposable, RunnableDisposable, SubscriptionDisposable

abstract class ReferenceDisposable<T> extends AtomicReference<T> implements Disposable
Base class for Disposable containers that manage some other type that has to be run when the container is disposed.
  • Field Details

  • Constructor Details

    • ReferenceDisposable

      ReferenceDisposable(T value)
  • Method Details

    • onDisposed

      protected abstract void onDisposed(@NonNull T value)
    • dispose

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

      public final 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