Package io.reactivex.rxjava3.disposables
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
,java.io.Serializable
- Direct Known Subclasses:
ActionDisposable
,AutoCloseableDisposable
,RunnableDisposable
,SubscriptionDisposable
abstract class ReferenceDisposable<T> extends java.util.concurrent.atomic.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 Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description ReferenceDisposable(T value)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
dispose()
Dispose the resource, the operation should be idempotent.boolean
isDisposed()
Returns true if this resource has been disposed.protected abstract void
onDisposed(T value)
-
Methods inherited from class java.util.concurrent.atomic.AtomicReference
accumulateAndGet, compareAndExchange, compareAndExchangeAcquire, compareAndExchangeRelease, compareAndSet, get, getAcquire, getAndAccumulate, getAndSet, getAndUpdate, getOpaque, getPlain, lazySet, set, setOpaque, setPlain, setRelease, toString, updateAndGet, weakCompareAndSet, weakCompareAndSetAcquire, weakCompareAndSetPlain, weakCompareAndSetRelease, weakCompareAndSetVolatile
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ReferenceDisposable
ReferenceDisposable(T value)
-
-
Method Detail
-
dispose
public final void dispose()
Description copied from interface:Disposable
Dispose the resource, the operation should be idempotent.- Specified by:
dispose
in interfaceDisposable
-
isDisposed
public final 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
-
-