| java.lang.Object | |
| ↳ | io.reactivex.disposables.SerialDisposable |
A Disposable container that allows atomically updating/replacing the contained Disposable with another Disposable, disposing the old one when updating plus handling the disposition when the container itself is disposed.
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
SerialDisposable()
Constructs an empty SerialDisposable.
| |||||||||||
|
SerialDisposable(Disposable initialDisposable)
Constructs a SerialDisposable with the given initial Disposable instance.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| void |
dispose()
Dispose the resource, the operation should be idempotent.
| ||||||||||
| 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(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(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.
| ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
io.reactivex.disposables.Disposable
| |||||||||||
Constructs an empty SerialDisposable.
Constructs a SerialDisposable with the given initial Disposable instance.
| initialDisposable | the initial Disposable instance to use, null allowed |
|---|
Dispose the resource, the operation should be idempotent.
Returns the currently contained Disposable or null if this container is empty.
Returns true if this resource has been disposed.
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.
| next | the Disposable to set, may be null |
|---|
Atomically: set the next disposable on this container and dispose the previous one (if any) or dispose next if the container has been disposed.
| next | the Disposable to set, may be null |
|---|