Top Description Constructors Methods
io.reactivex

public abstract Class Completable

extends Object
implements CompletableSource
Class Inheritance
All Implemented Interfaces
io.reactivex.CompletableSource
Known Direct Subclasses
io.reactivex.internal.operators.completable.CompletableFromPublisher, io.reactivex.internal.operators.completable.CompletableAmb, io.reactivex.internal.operators.completable.CompletableAndThenCompletable, io.reactivex.internal.operators.completable.CompletableCache, io.reactivex.internal.operators.completable.CompletableConcat, io.reactivex.internal.operators.completable.CompletableConcatArray, io.reactivex.internal.operators.completable.CompletableConcatIterable, io.reactivex.internal.operators.completable.CompletableCreate, io.reactivex.internal.operators.completable.CompletableDefer, io.reactivex.internal.operators.completable.CompletableDelay, io.reactivex.internal.operators.completable.CompletableDetach, io.reactivex.internal.operators.completable.CompletableDisposeOn, io.reactivex.internal.operators.completable.CompletableDoFinally, io.reactivex.internal.operators.completable.CompletableDoOnEvent, io.reactivex.internal.operators.completable.CompletableEmpty, io.reactivex.internal.operators.completable.CompletableError, io.reactivex.internal.operators.completable.CompletableErrorSupplier, io.reactivex.internal.operators.completable.CompletableFromAction, io.reactivex.internal.operators.completable.CompletableFromCallable, io.reactivex.internal.operators.completable.CompletableFromObservable, io.reactivex.internal.operators.completable.CompletableFromRunnable, io.reactivex.internal.operators.completable.CompletableFromSingle, io.reactivex.internal.operators.completable.CompletableFromUnsafeSource, io.reactivex.internal.operators.completable.CompletableHide, io.reactivex.internal.operators.completable.CompletableLift, io.reactivex.internal.operators.completable.CompletableMerge, io.reactivex.internal.operators.completable.CompletableMergeArray, io.reactivex.internal.operators.completable.CompletableMergeDelayErrorArray, io.reactivex.internal.operators.completable.CompletableMergeDelayErrorIterable, io.reactivex.internal.operators.completable.CompletableMergeIterable, io.reactivex.internal.operators.completable.CompletableNever, io.reactivex.internal.operators.completable.CompletableObserveOn, io.reactivex.internal.operators.completable.CompletableOnErrorComplete, io.reactivex.internal.operators.completable.CompletablePeek, io.reactivex.internal.operators.completable.CompletableResumeNext, io.reactivex.internal.operators.completable.CompletableSubscribeOn, io.reactivex.internal.operators.completable.CompletableTakeUntilCompletable, io.reactivex.internal.operators.completable.CompletableTimeout, io.reactivex.internal.operators.completable.CompletableTimer, io.reactivex.internal.operators.completable.CompletableUsing, io.reactivex.internal.operators.flowable.FlowableIgnoreElementsCompletable, io.reactivex.internal.operators.flowable.FlowableFlatMapCompletableCompletable, io.reactivex.internal.operators.maybe.MaybeIgnoreElementCompletable, io.reactivex.internal.operators.maybe.MaybeFlatMapCompletable, io.reactivex.internal.operators.mixed.FlowableConcatMapCompletable, io.reactivex.internal.operators.mixed.FlowableSwitchMapCompletable, io.reactivex.internal.operators.mixed.ObservableConcatMapCompletable, io.reactivex.internal.operators.mixed.ObservableSwitchMapCompletable, io.reactivex.internal.operators.observable.ObservableFlatMapCompletableCompletable, io.reactivex.internal.operators.observable.ObservableIgnoreElementsCompletable, io.reactivex.internal.operators.single.SingleFlatMapCompletable, io.reactivex.internal.schedulers.SchedulerWhen.CreateWorkerFunction.WorkerCompletable, io.reactivex.subjects.CompletableSubject
Imports
java.util.concurrent.*, org.reactivestreams.Publisher, io.reactivex.annotations.*, io.reactivex.disposables.Disposable, io.reactivex.exceptions.Exceptions, io.reactivex.functions.*, io.reactivex.internal.functions.*, io.reactivex.internal.fuseable.*, io.reactivex.internal.observers.*, io.reactivex.internal.operators.completable.*, io.reactivex.internal.operators.maybe.*, io.reactivex.internal.operators.mixed.*, io.reactivex.internal.operators.single.*, io.reactivex.internal.util.ExceptionHelper, io.reactivex.observers.TestObserver, io.reactivex.plugins.RxJavaPlugins, io.reactivex.schedulers.Schedulers

The Completable class represents a deferred computation without any value but only indication for completion or exception.

Completable behaves similarly to Observable except that it can only emit either a completion or error signal (there is no onNext or onSuccess as with the other reactive types).

The Completable class implements the CompletableSource base interface and the default consumer type it interacts with is the CompletableObserver via the subscribe(CompletableObserver) method. The Completable operates with the following sequential protocol:


    onSubscribe (onError | onComplete)?

Note that as with the Observable protocol, onError and onComplete are mutually exclusive events.

Like Observable, a running Completable can be stopped through the Disposable instance provided to consumers through SingleObserver#onSubscribe.

Like an Observable, a Completable is lazy, can be either "hot" or "cold", synchronous or asynchronous. Completable instances returned by the methods of this class are cold and there is a standard hot implementation in the form of a subject: CompletableSubject.

The documentation for this class makes use of marble diagrams. The following legend explains these diagrams:

See Flowable or Observable for the implementation of the Reactive Pattern for a stream or vector of values.

Example:


Disposable d = Completable.complete()
   .delay(10, TimeUnit.SECONDS, Schedulers.io())
   .subscribeWith(new DisposableCompletableObserver() {
       @Override
       public void onStart() {
           System.out.println("Started");
       }

       @Override
       public void onError(Throwable error) {
           error.printStackTrace();
       }

       @Override
       public void onComplete() {
           System.out.println("Done!");
       }
   });

Thread.sleep(5000);

d.dispose();

Note that by design, subscriptions via subscribe(CompletableObserver) can't be disposed from the outside (hence the void return of the subscribe(CompletableObserver) method) and it is the responsibility of the implementor of the CompletableObserver to allow this to happen. RxJava supports such usage with the standard DisposableCompletableObserver instance. For convenience, the subscribeWith(CompletableObserver) method is provided as well to allow working with a CompletableObserver (or subclass) instance to be applied with in a fluent manner (such as in the example above).

See Also
io.reactivex.observers.DisposableCompletableObserver

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Completable

Returns:

the new Completable instance
amb
(final Iterable<? extends CompletableSource>
the array of source Completables. A subscription to each source will occur in the same order as in this Iterable.
sources
)

Returns a Completable which terminates as soon as one of the source Completables terminates (normally or with an error) and disposes all other Completables.

public static Completable

Returns:

the new Completable instance
ambArray
(final CompletableSource...
the array of source Completables. A subscription to each source will occur in the same order as in this array.
sources
)

Returns a Completable which terminates as soon as one of the source Completables terminates (normally or with an error) and disposes all other Completables.

public final Completable

Returns:

the new Completable instance
ambWith
(CompletableSource
the other Completable, not null. A subscription to this provided source will occur after subscribing to the current source.
other
)

Returns a Completable that emits the a terminated event of either this Completable or the other Completable whichever fires first.

public final <
the value type of the next ObservableSource
T
>
Observable<T>

Returns:

Observable that composes this Completable and next
andThen
(ObservableSource<T>
the Observable to subscribe after this Completable is completed, not null
next
)

Returns an Observable which will subscribe to this Completable and once that is completed then will subscribe to the next ObservableSource.

public final <
the value type of the next Publisher
T
>
Flowable<T>

Returns:

Flowable that composes this Completable and next
andThen
(Publisher<T>
the Publisher to subscribe after this Completable is completed, not null
next
)

Returns a Flowable which will subscribe to this Completable and once that is completed then will subscribe to the next Flowable.

public final <
the value type of the next SingleSource
T
>
Single<T>

Returns:

Single that composes this Completable and next
andThen
(SingleSource<T>
the Single to subscribe after this Completable is completed, not null
next
)

Returns a Single which will subscribe to this Completable and once that is completed then will subscribe to the next SingleSource.

public final <
the value type of the next MaybeSource
T
>
Maybe<T>

Returns:

Maybe that composes this Completable and next
andThen
(MaybeSource<T>
the Maybe to subscribe after this Completable is completed, not null
next
)

Returns a Maybe which will subscribe to this Completable and once that is completed then will subscribe to the next MaybeSource.

public final Completable

Returns:

the new Completable instance
andThen
(CompletableSource
the other Completable, not null
next
)

Returns a Completable that first runs this Completable and then the other completable.

public final <
the resulting object type
R
>
R

Returns:

the converted value
as
(CompletableConverter<? extends R>
the function that receives the current Completable instance and returns a value
converter
)

Calls the specified converter function during assembly time and returns its resulting value.

public final void
blockingAwait()

Subscribes to and awaits the termination of this Completable instance in a blocking manner and rethrows any exception emitted.

public final boolean

Returns:

true if the this Completable instance completed normally within the time limit, false if the timeout elapsed before this Completable terminated.
blockingAwait
(long
the timeout value
timeout
,
TimeUnit
the timeout unit
unit
)

Subscribes to and awaits the termination of this Completable instance in a blocking manner with a specific timeout and rethrows any exception emitted within the timeout window.

public final Throwable

Returns:

the throwable if this terminated with an error, null otherwise
blockingGet
()

Subscribes to this Completable instance and blocks until it terminates, then returns null or the emitted exception if any.

public final Throwable

Returns:

the throwable if this terminated with an error, null otherwise
blockingGet
(long
the timeout value
timeout
,
TimeUnit
the time unit
unit
)

Subscribes to this Completable instance and blocks until it terminates or the specified timeout elapses, then returns null for normal termination or the emitted exception if any.

public final Completable

Returns:

the new Completable instance
cache
()

Subscribes to this Completable only once, when the first CompletableObserver subscribes to the result Completable, caches its terminal event and relays/replays it to observers.

public static Completable

Returns:

a Completable instance that completes immediately
complete
()

Returns a Completable instance that completes immediately when subscribed to.

public final Completable

Returns:

the Completable returned by the function
compose
(CompletableTransformer
the transformer function, not null
transformer
)

Calls the given transformer function with this instance and returns the function's resulting Completable.

public static Completable

Returns:

the Completable instance which completes only when all sources complete
concat
(Iterable<? extends CompletableSource>
the sources to concatenate
sources
)

Returns a Completable which completes only when all sources complete, one after another.

public static Completable

Returns:

the Completable instance which completes only when all sources complete
concat
(Publisher<? extends CompletableSource>
the sources to concatenate
sources
)

Returns a Completable which completes only when all sources complete, one after another.

public static Completable

Returns:

the Completable instance which completes only when all sources complete
concat
(Publisher<? extends CompletableSource>
the sources to concatenate
sources
,
int
the number of sources to prefetch from the sources
prefetch
)

Returns a Completable which completes only when all sources complete, one after another.

public static Completable

Returns:

the Completable instance which completes only when all sources complete
concatArray
(CompletableSource...
the sources to concatenate
sources
)

Returns a Completable which completes only when all sources complete, one after another.

public final Completable

Returns:

the new Completable which subscribes to this and then the other Completable
concatWith
(CompletableSource
the other Completable, not null
other
)

Concatenates this Completable with another Completable.

public static Completable

Returns:

the new Completable instance
create
(CompletableOnSubscribe
the emitter that is called when a CompletableObserver subscribes to the returned Completable
source
)

Provides an API (via a cold Completable) that bridges the reactive world with the callback-style world.

public static Completable

Returns:

the Completable instance
defer
(final Callable<? extends CompletableSource>
the supplier that returns the Completable that will be subscribed to.
completableSupplier
)

Defers the subscription to a Completable instance returned by a supplier.

public final Completable

Returns:

the new Completable instance
delay
(long
the delay time
delay
,
TimeUnit
the delay unit
unit
)

Returns a Completable which delays the emission of the completion event by the given time.

public final Completable

Returns:

the new Completable instance
delay
(long
the delay time
delay
,
TimeUnit
the delay unit
unit
,
Scheduler
the scheduler to run the delayed completion on
scheduler
)

Returns a Completable which delays the emission of the completion event by the given time while running on the specified scheduler.

public final Completable

Returns:

the new Completable instance
delay
(final long
the delay time
delay
,
final TimeUnit
the delay unit
unit
,
final Scheduler
the scheduler to run the delayed completion on
scheduler
,
final boolean
delay the error emission as well?
delayError
)

Returns a Completable which delays the emission of the completion event, and optionally the error as well, by the given time while running on the specified scheduler.

public final Completable

Returns:

a Completable that delays the subscription to the source CompletableSource by the given amount
delaySubscription
(long
the time to delay the subscription
delay
,
TimeUnit
the time unit of delay
unit
)

Returns a Completable that delays the subscription to the source CompletableSource by a given amount of time.

public final Completable

Returns:

a Completable that delays the subscription to the source CompletableSource by a given amount, waiting and subscribing on the given Scheduler
delaySubscription
(long
the time to delay the subscription
delay
,
TimeUnit
the time unit of delay
unit
,
Scheduler
the Scheduler on which the waiting and subscription will happen
scheduler
)

Returns a Completable that delays the subscription to the source CompletableSource by a given amount of time, both waiting and subscribing on a given Scheduler.

public final Completable

Returns:

the new Completable instance
doAfterTerminate
(final Action
the callback to call after this Completable terminates
onAfterTerminate
)

Returns a Completable instance that calls the given onTerminate callback after this Completable completes normally or with an exception.

public final Completable

Returns:

the new Completable instance
doFinally
(Action
the action called when this Completable terminates or gets disposed
onFinally
)

Calls the specified action after this Completable signals onError or onComplete or gets disposed by the downstream.

public final Completable

Returns:

the new Completable instance
doOnComplete
(Action
the callback to call when this emits an onComplete event
onComplete
)

Returns a Completable which calls the given onComplete callback if this Completable completes.

public final Completable

Returns:

the new Completable instance
doOnDispose
(Action
the action to call when the child subscriber disposes the subscription
onDispose
)

Calls the shared Action if a CompletableObserver subscribed to the current Completable disposes the common Disposable it received via onSubscribe.

public final Completable

Returns:

the new Completable instance
doOnError
(Consumer<? super Throwable>
the error callback
onError
)

Returns a Completable which calls the given onError callback if this Completable emits an error.

public final Completable

Returns:

the new Completable instance
doOnEvent
(final Consumer<? super Throwable>
the event callback
onEvent
)

Returns a Completable which calls the given onEvent callback with the (throwable) for an onError or (null) for an onComplete signal from this Completable before delivering said signal to the downstream.

private Completable

Returns:

the new Completable instance
doOnLifecycle
(final Consumer<? super Disposable>
the consumer called when a CompletableSubscriber subscribes.
onSubscribe
,
final Consumer<? super Throwable>
the consumer called when this emits an onError event
onError
,
final Action
the runnable called just before when this Completable completes normally
onComplete
,
final Action onTerminate, final Action
the runnable called after this Completable completes normally
onAfterTerminate
,
final Action
the runnable called when the child disposes the subscription
onDispose
)

Returns a Completable instance that calls the various callbacks on the specific lifecycle events.

public final Completable

Returns:

the new Completable instance
doOnSubscribe
(Consumer<? super Disposable>
the callback called when a child subscriber subscribes
onSubscribe
)

Returns a Completable instance that calls the given onSubscribe callback with the disposable that child subscribers receive on subscription.

public final Completable

Returns:

the new Completable instance
doOnTerminate
(final Action
the callback to call just before this Completable terminates
onTerminate
)

Returns a Completable instance that calls the given onTerminate callback just before this Completable completes normally or with an exception.

public static Completable

Returns:

the new Completable instance
error
(final Callable<? extends Throwable>
the error supplier, not null
errorSupplier
)

Creates a Completable which calls the given error supplier for each subscriber and emits its returned Throwable.

public static Completable

Returns:

the new Completable instance
error
(final Throwable
the Throwable instance to emit, not null
error
)

Creates a Completable instance that emits the given Throwable exception to subscribers.

public static Completable

Returns:

the new Completable instance
fromAction
(final Action
the runnable to run for each subscriber
run
)

Returns a Completable instance that runs the given Action for each subscriber and emits either an unchecked exception or simply completes.

public static Completable

Returns:

the new Completable instance
fromCallable
(final Callable<?>
the callable instance to execute for each subscriber
callable
)

Returns a Completable which when subscribed, executes the callable function, ignores its normal result and emits onError or onComplete only.

public static Completable

Returns:

the new Completable instance
fromFuture
(final Future<?>
the future to react to
future
)

Returns a Completable instance that reacts to the termination of the given Future in a blocking fashion.

public static <
the value type of the MaybeSource element
T
>
Completable

Returns:

the new Completable instance
fromMaybe
(final MaybeSource<T>
the Maybe instance to subscribe to, not null
maybe
)

Returns a Completable instance that when subscribed to, subscribes to the Maybe instance and emits a completion event if the maybe emits onSuccess/onComplete or forwards any onError events.

public static <
the type of the Observable
T
>
Completable

Returns:

the new Completable instance
fromObservable
(final ObservableSource<T>
the Observable instance to subscribe to, not null
observable
)

Returns a Completable instance that subscribes to the given Observable, ignores all values and emits only the terminal event.

public static <
the type of the publisher
T
>
Completable

Returns:

the new Completable instance
fromPublisher
(final Publisher<T>
the Publisher instance to subscribe to, not null
publisher
)

Returns a Completable instance that subscribes to the given publisher, ignores all values and emits only the terminal event.

public static Completable

Returns:

the new Completable instance
fromRunnable
(final Runnable
the runnable to run for each subscriber
run
)

Returns a Completable instance that runs the given Runnable for each subscriber and emits either its exception or simply completes.

public static <
the value type of the Single
T
>
Completable

Returns:

the new Completable instance
fromSingle
(final SingleSource<T>
the Single instance to subscribe to, not null
single
)

Returns a Completable instance that when subscribed to, subscribes to the Single instance and emits a completion event if the single emits onSuccess or forwards any onError events.

public final Completable

Returns:

the new Completable instance
hide
()

Hides the identity of this Completable and its Disposable.

public final Completable

Returns:

the new Completable instance
lift
(final CompletableOperator
the CompletableOperator that receives the downstream's CompletableObserver and should return a CompletableObserver with custom behavior to be used as the consumer for the current Completable.
onLift
)

This method requires advanced knowledge about building operators, please consider other standard composition methods first; Returns a Completable which, when subscribed to, invokes the apply(CompletableObserver) method of the provided CompletableOperator for each individual downstream Completable and allows the insertion of a custom operator by accessing the downstream's CompletableObserver during this subscription phase and providing a new CompletableObserver, containing the custom operator's intended business logic, that will be used in the subscription process going further upstream.

public final <
the intended target element type of the notification
T
>
Single<Notification<T>>

Returns:

the new Single instance
materialize
()

Maps the signal types of this Completable into a Notification of the same kind and emits it as a single success value to downstream.

public static Completable

Returns:

the new Completable instance
merge
(Iterable<? extends CompletableSource>
the iterable sequence of sources.
sources
)

Returns a Completable instance that subscribes to all sources at once and completes only when all source Completables complete or one of them emits an error.

public static Completable

Returns:

the new Completable instance
merge
(Publisher<? extends CompletableSource>
the iterable sequence of sources.
sources
)

Returns a Completable instance that subscribes to all sources at once and completes only when all source Completables complete or one of them emits an error.

public static Completable

Returns:

the new Completable instance
merge
(Publisher<? extends CompletableSource>
the iterable sequence of sources.
sources
,
int
the maximum number of concurrent subscriptions
maxConcurrency
)

Returns a Completable instance that keeps subscriptions to a limited number of sources at once and completes only when all source Completables complete or one of them emits an error.

private static Completable

Returns:

the new Completable instance
merge0
(Publisher<? extends CompletableSource>
the iterable sequence of sources.
sources
,
int
the maximum number of concurrent subscriptions
maxConcurrency
,
boolean
delay all errors from the main source and from the inner Completables?
delayErrors
)

Returns a Completable instance that keeps subscriptions to a limited number of sources at once and completes only when all source Completables terminate in one way or another, combining any exceptions thrown by either the sources Observable or the inner Completable instances.

public static Completable

Returns:

the new Completable instance
mergeArray
(CompletableSource...
the iterable sequence of sources.
sources
)

Returns a Completable instance that subscribes to all sources at once and completes only when all source Completables complete or one of them emits an error.

public static Completable

Returns:

the new Completable instance
mergeArrayDelayError
(CompletableSource...
the array of Completables
sources
)

Returns a CompletableConsumable that subscribes to all Completables in the source array and delays any error emitted by either the sources observable or any of the inner Completables until all of them terminate in a way or another.

public static Completable

Returns:

the new Completable instance
mergeDelayError
(Iterable<? extends CompletableSource>
the sequence of Completables
sources
)

Returns a Completable that subscribes to all Completables in the source sequence and delays any error emitted by either the sources observable or any of the inner Completables until all of them terminate in a way or another.

public static Completable

Returns:

the new Completable instance
mergeDelayError
(Publisher<? extends CompletableSource>
the sequence of Completables
sources
)

Returns a Completable that subscribes to all Completables in the source sequence and delays any error emitted by either the sources observable or any of the inner Completables until all of them terminate in a way or another.

public static Completable

Returns:

the new Completable instance
mergeDelayError
(Publisher<? extends CompletableSource>
the sequence of Completables
sources
,
int
the maximum number of concurrent subscriptions to Completables
maxConcurrency
)

Returns a Completable that subscribes to a limited number of inner Completables at once in the source sequence and delays any error emitted by either the sources observable or any of the inner Completables until all of them terminate in a way or another.

public final Completable

Returns:

the new Completable instance
mergeWith
(CompletableSource
the other Completable instance
other
)

Returns a Completable which subscribes to this and the other Completable and completes when both of them complete or one emits an error.

public static Completable

Returns:

the singleton instance that never calls onError or onComplete
never
()

Returns a Completable that never calls onError or onComplete.

public final Completable

Returns:

the new Completable instance
observeOn
(final Scheduler
the scheduler to emit terminal events on
scheduler
)

Returns a Completable which emits the terminal events from the thread of the specified scheduler.

public final Completable

Returns:

the new Completable instance
onErrorComplete
()

Returns a Completable instance that if this Completable emits an error, it will emit an onComplete and swallow the throwable.

public final Completable

Returns:

the new Completable instance
onErrorComplete
(final Predicate<? super Throwable>
the predicate to call when an Throwable is emitted which should return true if the Throwable should be swallowed and replaced with an onComplete.
predicate
)

Returns a Completable instance that if this Completable emits an error and the predicate returns true, it will emit an onComplete and swallow the throwable.

public final Completable

Returns:

the new Completable instance
onErrorResumeNext
(final Function<? super Throwable, ? extends CompletableSource>
the mapper function that takes the error and should return a Completable as continuation.
errorMapper
)

Returns a Completable instance that when encounters an error from this Completable, calls the specified mapper function that returns another Completable instance for it and resumes the execution with it.

public final Completable

Returns:

a Completable which nulls out references to the upstream producer and downstream CompletableObserver if the sequence is terminated or downstream calls dispose()
onTerminateDetach
()

Nulls out references to the upstream producer and downstream CompletableObserver if the sequence is terminated or downstream calls dispose().

public final Completable

Returns:

the new Completable instance
repeat
()

Returns a Completable that repeatedly subscribes to this Completable until disposed.

public final Completable

Returns:

the new Completable instance
repeat
(long
the number of times the resubscription should happen
times
)

Returns a Completable that subscribes repeatedly at most the given times to this Completable.

public final Completable

Returns:

the new Completable instance
repeatUntil
(BooleanSupplier
the supplier that should return true to stop resubscribing.
stop
)

Returns a Completable that repeatedly subscribes to this Completable so long as the given stop supplier returns false.

public final Completable

Returns:

the new Completable instance
repeatWhen
(Function<? super Flowable<Object>, ? extends Publisher<?>>
the function that transforms the stream of values indicating the completion of this Completable and returns a Publisher that emits items for repeating or completes to indicate the repetition should stop
handler
)

Returns a Completable instance that repeats when the Publisher returned by the handler emits an item or completes when this Publisher emits a completed event.

public final Completable

Returns:

the new Completable instance
retry
()

Returns a Completable that retries this Completable as long as it emits an onError event.

public final Completable

Returns:

the new Completable instance
retry
(BiPredicate<? super Integer, ? super Throwable>
the predicate called when this emits an error with the repeat count and the latest exception and should return true to retry.
predicate
)

Returns a Completable that retries this Completable in case of an error as long as the predicate returns true.

public final Completable

Returns:

the new Completable instance
retry
(long
the number of times to resubscribe if the current Completable fails
times
)

Returns a Completable that when this Completable emits an error, retries at most the given number of times before giving up and emitting the last error.

public final Completable

Returns:

the new Completable instance
retry
(long
the number of times to resubscribe if the current Completable fails
times
,
Predicate<? super Throwable>
the predicate that is called with the latest throwable and should return true to indicate the returned Completable should resubscribe to this Completable.
predicate
)

Returns a Completable that when this Completable emits an error, retries at most times or until the predicate returns false, whichever happens first and emitting the last error.

public final Completable

Returns:

the new Completable instance
retry
(Predicate<? super Throwable>
the predicate that is called with the latest throwable and should return true to indicate the returned Completable should resubscribe to this Completable.
predicate
)

Returns a Completable that when this Completable emits an error, calls the given predicate with the latest exception to decide whether to resubscribe to this or not.

public final Completable

Returns:

the new Completable instance
retryWhen
(Function<? super Flowable<Throwable>, ? extends Publisher<?>>
the handler that receives a Flowable delivering Throwables and should return a Publisher that emits items to indicate retries or emits terminal events to indicate termination.
handler
)

Returns a Completable which given a Publisher and when this Completable emits an error, delivers that error through a Flowable and the Publisher should signal a value indicating a retry in response or a terminal event indicating a termination.

public final Completable

Returns:

the new Completable instance
startWith
(CompletableSource
the other completable to run first
other
)

Returns a Completable which first runs the other Completable then this completable if the other completed normally.

public final <
the value type
T
>
Observable<T>

Returns:

the new Observable instance
startWith
(Observable<T>
the other Observable to run first
other
)

Returns an Observable which first delivers the events of the other Observable then runs this CompletableConsumable.

public final <
the value type
T
>
Flowable<T>

Returns:

the new Flowable instance
startWith
(Publisher<T>
the other Publisher to run first
other
)

Returns a Flowable which first delivers the events of the other Publisher then runs this Completable.

public final Disposable

Returns:

the Disposable that allows disposing the subscription
subscribe
()

Subscribes to this CompletableConsumable and returns a Disposable which can be used to dispose the subscription.

public final void
subscribe(CompletableObserver
the CompletableObserver, not null
observer
)

Implements io.reactivex.CompletableSource.subscribe.

Subscribes the given CompletableObserver to this CompletableSource instance.
public final Disposable

Returns:

the Disposable that can be used for disposing the subscription asynchronously
subscribe
(final Action
the runnable that is called if the Completable completes normally
onComplete
,
final Consumer<? super Throwable>
the consumer that is called if this Completable emits an error
onError
)

Subscribes to this Completable and calls back either the onError or onComplete functions.

public final Disposable

Returns:

the Disposable that allows disposing the subscription
subscribe
(final Action
the runnable called when this Completable completes normally
onComplete
)

Subscribes to this Completable and calls the given Action when this Completable completes normally.

protected abstract void
subscribeActual(CompletableObserver
the CompletableObserver instance, never null
observer
)

Implement this method to handle the incoming CompletableObservers and perform the business logic in your operator.

public final Completable

Returns:

the new Completable instance
subscribeOn
(final Scheduler
the Scheduler to subscribe on
scheduler
)

Returns a Completable which subscribes the child subscriber on the specified scheduler, making sure the subscription side-effects happen on that specific thread of the scheduler.

public final <
the type of the CompletableObserver to use and return
E extends CompletableObserver
>
E

Returns:

the input observer
subscribeWith
(E
the CompletableObserver (subclass) to use and return, not null
observer
)

Subscribes a given CompletableObserver (subclass) to this Completable and returns the given CompletableObserver as is.

public final Completable

Returns:

the new Completable instance
takeUntil
(CompletableSource
the other completable source to observe for the terminal signals
other
)

Terminates the downstream if this or the other Completable terminates (wins the termination race) while disposing the connection to the losing source.

public final TestObserver<Void>

Returns:

the new TestObserver instance
test
()

Creates a TestObserver and subscribes it to this Completable.

public final TestObserver<Void>

Returns:

the new TestObserver instance
test
(boolean
if true, the TestObserver will be cancelled before subscribing to this Completable.

Scheduler:
test does not operate by default on a particular Scheduler.
cancelled
)

Creates a TestObserver optionally in cancelled state, then subscribes it to this Completable.

public final Completable

Returns:

the new Completable instance
timeout
(long
the timeout value
timeout
,
TimeUnit
the timeout unit
unit
)

Returns a Completable that runs this Completable and emits a TimeoutException in case this Completable doesn't complete within the given time.

public final Completable

Returns:

the new Completable instance
timeout
(long
the timeout value
timeout
,
TimeUnit
the timeout unit
unit
,
CompletableSource
the other Completable instance to switch to in case of a timeout
other
)

Returns a Completable that runs this Completable and switches to the other Completable in case this Completable doesn't complete within the given time.

public final Completable

Returns:

the new Completable instance
timeout
(long
the timeout value
timeout
,
TimeUnit
the timeout unit
unit
,
Scheduler
the scheduler to use to wait for completion
scheduler
)

Returns a Completable that runs this Completable and emits a TimeoutException in case this Completable doesn't complete within the given time while "waiting" on the specified Scheduler.

public final Completable

Returns:

the new Completable instance
timeout
(long
the timeout value
timeout
,
TimeUnit
the timeout unit
unit
,
Scheduler
the scheduler to use to wait for completion
scheduler
,
CompletableSource
the other Completable instance to switch to in case of a timeout
other
)

Returns a Completable that runs this Completable and switches to the other Completable in case this Completable doesn't complete within the given time while "waiting" on the specified scheduler.

private Completable

Returns:

the new Completable instance
timeout0
(long
the timeout value
timeout
,
TimeUnit
the timeout unit
unit
,
Scheduler
the scheduler to use to wait for completion
scheduler
,
CompletableSource
the other Completable instance to switch to in case of a timeout, if null a TimeoutException is emitted instead
other
)

Returns a Completable that runs this Completable and optionally switches to the other Completable in case this Completable doesn't complete within the given time while "waiting" on the specified scheduler.

public static Completable

Returns:

the new Completable instance
timer
(long
the delay time
delay
,
TimeUnit
the delay unit
unit
)

Returns a Completable instance that fires its onComplete event after the given delay elapsed.

public static Completable

Returns:

the new Completable instance
timer
(final long
the delay time
delay
,
final TimeUnit
the delay unit
unit
,
final Scheduler
the scheduler where to emit the complete event
scheduler
)

Returns a Completable instance that fires its onComplete event after the given delay elapsed by using the supplied scheduler.

public final <
the output type
U
>
U

Returns:

the converted value
to
(Function<? super Completable, U>
the function called with this which should return some other value.
converter
)

Allows fluent conversion to another type via a function callback.

public final <
the value type
T
>
Flowable<T>

Returns:

the new Flowable instance
toFlowable
()

Returns a Flowable which when subscribed to subscribes to this Completable and relays the terminal events to the subscriber.

public final <
the value type
T
>
Maybe<T>

Returns:

a Maybe that only calls onComplete or onError, based on which one is called by the source Completable.
toMaybe
()

Converts this Completable into a Maybe.

private static NullPointerException

Returns:

the created NullPointerException
toNpe
(Throwable
the Throwable instance to use as cause, not null (not verified)
ex
)

Creates a NullPointerException instance and sets the given Throwable as its initial cause.

public final <
the value type
T
>
Observable<T>

Returns:

the new Observable created
toObservable
()

Returns an Observable which when subscribed to subscribes to this Completable and relays the terminal events to the subscriber.

public final <
the value type
T
>
Single<T>

Returns:

the new Single instance
toSingle
(final Callable<? extends T>
the value supplier called when this Completable completes normally
completionValueSupplier
)

Converts this Completable into a Single which when this Completable completes normally, calls the given supplier and emits its returned value through onSuccess.

public final <
the value type
T
>
Single<T>

Returns:

the new Single instance
toSingleDefault
(final T
the value to emit when this Completable completes normally
completionValue
)

Converts this Completable into a Single which when this Completable completes normally, emits the given value through onSuccess.

public static Completable

Returns:

the created Completable instance
unsafeCreate
(CompletableSource
the callback which will receive the CompletableObserver instances when the Completable is subscribed to.
source
)

Constructs a Completable instance by wrapping the given source callback without any safeguards; you should manage the lifecycle and response to downstream disposal.

public final Completable

Returns:

the new Completable instance
unsubscribeOn
(final Scheduler
the target scheduler where to execute the disposing
scheduler
)

Returns a Completable which makes sure when a subscriber disposes the subscription, the dispose is called on the specified scheduler.

public static <
the resource type
R
>
Completable

Returns:

the new Completable instance
using
(Callable<R>
the supplier that returns a resource to be managed.
resourceSupplier
,
Function<? super R, ? extends CompletableSource>
the function that given a resource returns a Completable instance that will be subscribed to
completableFunction
,
Consumer<? super R>
the consumer that disposes the resource created by the resource supplier
disposer
)

Returns a Completable instance which manages a resource along with a custom Completable instance while the subscription is active.

public static <
the resource type
R
>
Completable

Returns:

the new Completable instance
using
(final Callable<R>
the supplier that returns a resource to be managed
resourceSupplier
,
final Function<? super R, ? extends CompletableSource>
the function that given a resource returns a non-null Completable instance that will be subscribed to
completableFunction
,
final Consumer<? super R>
the consumer that disposes the resource created by the resource supplier
disposer
,
final boolean
if true, the resource is disposed before the terminal event is emitted, if false, the resource is disposed after the terminal event has been emitted
eager
)

Returns a Completable instance which manages a resource along with a custom Completable instance while the subscription is active and performs eager or lazy resource disposition.

public static Completable

Returns:

the source or its wrapper Completable
wrap
(CompletableSource
the source to wrap
source
)

Wraps the given CompletableSource into a Completable if not already Completable.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait