public final class CompletableSubject extends Completable implements CompletableObserver
All methods are thread safe. Calling onComplete multiple times has no effect. Calling onError multiple times relays the Throwable to the RxJavaPlugins' error handler.
The CompletableSubject doesn't store the Disposables coming through onSubscribe but disposes them once the other onXXX methods were called (terminal state reached).
Modifier and Type | Method and Description |
---|---|
static CompletableSubject |
create()
Creates a fresh CompletableSubject.
|
java.lang.Throwable |
getThrowable()
Returns the terminal error if this CompletableSubject has been terminated with an error, null otherwise.
|
boolean |
hasComplete()
Returns true if this CompletableSubject has been completed.
|
boolean |
hasObservers()
Returns true if this CompletableSubject has observers.
|
boolean |
hasThrowable()
Returns true if this CompletableSubject has been terminated with an error.
|
void |
onComplete()
Called once the deferred computation completes normally.
|
void |
onError(java.lang.Throwable e)
Called once if the deferred computation 'throws' an exception.
|
void |
onSubscribe(Disposable d)
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 void |
subscribeActual(CompletableObserver observer)
Implement this to handle the incoming CompletableObserver and
perform the business logic in your operator.
|
amb, ambArray, ambWith, andThen, andThen, andThen, andThen, andThen, blockingAwait, blockingAwait, blockingGet, blockingGet, cache, complete, compose, concat, concat, concat, concatArray, concatWith, create, defer, delay, delay, delay, doAfterTerminate, doFinally, doOnComplete, doOnDispose, doOnError, doOnEvent, doOnSubscribe, doOnTerminate, error, error, fromAction, fromCallable, fromFuture, fromObservable, fromPublisher, fromRunnable, fromSingle, hide, lift, merge, merge, merge, mergeArray, mergeArrayDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeWith, never, observeOn, onErrorComplete, onErrorComplete, onErrorResumeNext, repeat, repeat, repeatUntil, repeatWhen, retry, retry, retry, retry, retryWhen, startWith, startWith, startWith, subscribe, subscribe, subscribe, subscribe, subscribeOn, subscribeWith, test, test, timeout, timeout, timeout, timeout, timer, timer, to, toFlowable, toMaybe, toObservable, toSingle, toSingleDefault, unsafeCreate, unsubscribeOn, using, using, wrap
@CheckReturnValue public static CompletableSubject create()
public void onSubscribe(Disposable d)
CompletableObserver
onSubscribe
in interface CompletableObserver
d
- the Disposable instance to call dispose on for cancellation, not nullpublic void onError(java.lang.Throwable e)
CompletableObserver
onError
in interface CompletableObserver
e
- the exception, not null.public void onComplete()
CompletableObserver
onComplete
in interface CompletableObserver
protected void subscribeActual(CompletableObserver observer)
Completable
subscribeActual
in class Completable
observer
- the CompletableObserver instance, never nullpublic java.lang.Throwable getThrowable()
public boolean hasThrowable()
public boolean hasComplete()
public boolean hasObservers()