Top Description Fields Constructors Methods
io.reactivex.rxjava3.observers

public abstract Class DisposableCompletableObserver

extends Object
implements CompletableObserver, Disposable
Class Inheritance
All Implemented Interfaces
io.reactivex.rxjava3.disposables.Disposable, io.reactivex.rxjava3.core.CompletableObserver
Imports
java.util.concurrent.atomic.AtomicReference, io.reactivex.rxjava3.annotations.NonNull, io.reactivex.rxjava3.core.CompletableObserver, io.reactivex.rxjava3.disposables.Disposable, io.reactivex.rxjava3.internal.disposables.DisposableHelper, io.reactivex.rxjava3.internal.util.EndConsumerHelper

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();

Field Summary

Modifier and TypeField and Description
pack-priv final AtomicReference<Disposable>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final void
dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.
public final boolean
isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.
protected void
onStart()

Called once the single upstream Disposable is set via onSubscribe(Disposable).

public final void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

upstreamback to summary
pack-priv final AtomicReference<Disposable> upstream

Constructor Detail

DisposableCompletableObserverback to summary
public DisposableCompletableObserver()

Method Detail

disposeback to summary
public final void dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Doc from io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.

Annotations
@Override
isDisposedback to summary
public final boolean isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Doc from io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.

Returns:boolean

true if this resource has been disposed

Annotations
@Override
onStartback to summary
protected void onStart()

Called once the single upstream Disposable is set via onSubscribe(Disposable).

onSubscribeback to summary
public final void onSubscribe(@NonNull Disposable d)
Annotations
@Override