public final class SerialDisposable extends Object implements Disposable
Constructor and Description |
---|
SerialDisposable()
Constructs an empty SerialDisposable.
|
SerialDisposable(@Nullable Disposable initialDisposable)
Constructs a SerialDisposable with the given initial Disposable instance.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Dispose the resource, the operation should be idempotent.
|
@Nullable Disposable |
get()
Returns the currently contained Disposable or null if this container is empty.
|
boolean |
isDisposed()
Returns true if this resource has been disposed.
|
boolean |
replace(@Nullable Disposable next)
Atomically: set the next disposable on this container but don't dispose the previous
one (if any) or dispose next if the container has been disposed.
|
boolean |
set(@Nullable Disposable next)
Atomically: set the next disposable on this container and dispose the previous
one (if any) or dispose next if the container has been disposed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
disposed, empty, fromAction, fromAutoCloseable, fromFuture, fromFuture, fromRunnable, fromSubscription, toAutoCloseable
public SerialDisposable()
public SerialDisposable(@Nullable @Nullable Disposable initialDisposable)
initialDisposable
- the initial Disposable instance to use, null allowedpublic boolean set(@Nullable @Nullable Disposable next)
next
- the Disposable to set, may be nullreplace(Disposable)
public boolean replace(@Nullable @Nullable Disposable next)
next
- the Disposable to set, may be nullset(Disposable)
@Nullable public @Nullable Disposable get()
public void dispose()
Disposable
dispose
in interface Disposable
public boolean isDisposed()
Disposable
isDisposed
in interface Disposable