| java.lang.Object | |
| ↳ | io.reactivex.observers.DisposableCompletableObserver |
An abstract CompletableObserver that allows asynchronous cancellation by implementing Disposable.
All pre-implemented final methods are thread-safe.
Like all other consumers, DisposableCompletableObserver can be subscribed only once.
Any subsequent attempt to subscribe it to a new source will yield an
IllegalStateException with message "It is not allowed to subscribe with a(n) <class name> multiple times.".
Implementation of onStart(), onError(Throwable) and
onComplete() are not allowed to throw any unchecked exceptions.
Example
Disposable d =
Completable.complete().delay(1, TimeUnit.SECONDS)
.subscribeWith(new DisposableMaybeObserver<Integer>() {
@Override public void onStart() {
System.out.println("Start!");
}
@Override public void onError(Throwable t) {
t.printStackTrace();
}
@Override public void onComplete() {
System.out.println("Done!");
}
});
// ...
d.dispose();
| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| DisposableCompletableObserver() | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| final void |
dispose()
Dispose the resource, the operation should be idempotent.
| ||||||||||
| final boolean |
isDisposed()
Returns true if this resource has been disposed.
| ||||||||||
| final void |
onSubscribe(Disposable s)
Called once by the Completable to set a Disposable on this instance which
then can be used to cancel the subscription at any time.
| ||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| void |
onStart()
Called once the single upstream Disposable is set via onSubscribe.
| ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
io.reactivex.CompletableObserver
| |||||||||||
From interface
io.reactivex.disposables.Disposable
| |||||||||||
Dispose the resource, the operation should be idempotent.
Returns true if this resource has been disposed.
Called once by the Completable to set a Disposable on this instance which then can be used to cancel the subscription at any time.
| s | the Disposable instance to call dispose on for cancellation, not null |
|---|
Called once the single upstream Disposable is set via onSubscribe.