Top Description Constructors Methods
io.reactivex.rxjava3.core

public abstract Class Completable

extends Object
implements CompletableSource
Class Inheritance
All Implemented Interfaces
io.reactivex.rxjava3.core.CompletableSource
Known Direct Subclasses
io.reactivex.rxjava3.internal.jdk8.CompletableFromCompletionStage, io.reactivex.rxjava3.internal.operators.completable.CompletableHide, io.reactivex.rxjava3.internal.operators.completable.CompletableAmb, io.reactivex.rxjava3.internal.operators.completable.CompletableAndThenCompletable, io.reactivex.rxjava3.internal.operators.completable.CompletableCache, io.reactivex.rxjava3.internal.operators.completable.CompletableConcat, io.reactivex.rxjava3.internal.operators.completable.CompletableConcatArray, io.reactivex.rxjava3.internal.operators.completable.CompletableConcatIterable, io.reactivex.rxjava3.internal.operators.completable.CompletableCreate, io.reactivex.rxjava3.internal.operators.completable.CompletableDefer, io.reactivex.rxjava3.internal.operators.completable.CompletableDelay, io.reactivex.rxjava3.internal.operators.completable.CompletableDetach, io.reactivex.rxjava3.internal.operators.completable.CompletableDisposeOn, io.reactivex.rxjava3.internal.operators.completable.CompletableDoFinally, io.reactivex.rxjava3.internal.operators.completable.CompletableDoOnEvent, io.reactivex.rxjava3.internal.operators.completable.CompletableEmpty, io.reactivex.rxjava3.internal.operators.completable.CompletableError, io.reactivex.rxjava3.internal.operators.completable.CompletableErrorSupplier, io.reactivex.rxjava3.internal.operators.completable.CompletableFromAction, io.reactivex.rxjava3.internal.operators.completable.CompletableFromCallable, io.reactivex.rxjava3.internal.operators.completable.CompletableFromObservable, io.reactivex.rxjava3.internal.operators.completable.CompletableFromPublisher, io.reactivex.rxjava3.internal.operators.completable.CompletableFromRunnable, io.reactivex.rxjava3.internal.operators.completable.CompletableFromSingle, io.reactivex.rxjava3.internal.operators.completable.CompletableFromSupplier, io.reactivex.rxjava3.internal.operators.completable.CompletableFromUnsafeSource, io.reactivex.rxjava3.internal.operators.completable.CompletableLift, io.reactivex.rxjava3.internal.operators.completable.CompletableMerge, io.reactivex.rxjava3.internal.operators.completable.CompletableMergeArray, io.reactivex.rxjava3.internal.operators.completable.CompletableMergeArrayDelayError, io.reactivex.rxjava3.internal.operators.completable.CompletableMergeDelayErrorIterable, io.reactivex.rxjava3.internal.operators.completable.CompletableMergeIterable, io.reactivex.rxjava3.internal.operators.completable.CompletableNever, io.reactivex.rxjava3.internal.operators.completable.CompletableObserveOn, io.reactivex.rxjava3.internal.operators.completable.CompletableOnErrorComplete, io.reactivex.rxjava3.internal.operators.completable.CompletablePeek, io.reactivex.rxjava3.internal.operators.completable.CompletableResumeNext, io.reactivex.rxjava3.internal.operators.completable.CompletableSubscribeOn, io.reactivex.rxjava3.internal.operators.completable.CompletableTakeUntilCompletable, io.reactivex.rxjava3.internal.operators.completable.CompletableTimeout, io.reactivex.rxjava3.internal.operators.completable.CompletableTimer, io.reactivex.rxjava3.internal.operators.completable.CompletableUsing, io.reactivex.rxjava3.internal.operators.flowable.FlowableFlatMapCompletableCompletable, io.reactivex.rxjava3.internal.operators.flowable.FlowableIgnoreElementsCompletable, io.reactivex.rxjava3.internal.operators.maybe.MaybeIgnoreElementCompletable, io.reactivex.rxjava3.internal.operators.maybe.MaybeFlatMapCompletable, io.reactivex.rxjava3.internal.operators.mixed.FlowableConcatMapCompletable, io.reactivex.rxjava3.internal.operators.mixed.FlowableSwitchMapCompletable, io.reactivex.rxjava3.internal.operators.mixed.FlowableSwitchMapCompletablePublisher, io.reactivex.rxjava3.internal.operators.mixed.ObservableConcatMapCompletable, io.reactivex.rxjava3.internal.operators.mixed.ObservableSwitchMapCompletable, io.reactivex.rxjava3.internal.operators.observable.ObservableFlatMapCompletableCompletable, io.reactivex.rxjava3.internal.operators.observable.ObservableIgnoreElementsCompletable, io.reactivex.rxjava3.internal.operators.single.SingleFlatMapCompletable, io.reactivex.rxjava3.internal.schedulers.SchedulerWhen.CreateWorkerFunction.WorkerCompletable, io.reactivex.rxjava3.subjects.CompletableSubject
Imports
java.util.*, java.util.concurrent.*, org.reactivestreams.*, io.reactivex.rxjava3.annotations.*, io.reactivex.rxjava3.disposables.*, io.reactivex.rxjava3.exceptions.*, io.reactivex.rxjava3.functions.*, io.reactivex.rxjava3.internal.functions.*, io.reactivex.rxjava3.internal.fuseable.*, io.reactivex.rxjava3.internal.jdk8.*, io.reactivex.rxjava3.internal.observers.*, io.reactivex.rxjava3.internal.operators.completable.*, io.reactivex.rxjava3.internal.operators.maybe.*, io.reactivex.rxjava3.internal.operators.mixed.*, io.reactivex.rxjava3.internal.operators.single.SingleDelayWithCompletable, io.reactivex.rxjava3.observers.TestObserver, io.reactivex.rxjava3.plugins.RxJavaPlugins, io.reactivex.rxjava3.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 CompletableObserver#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.rxjava3.observers.DisposableCompletableObserver

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static @NonNull Completable

Returns:

the new Completable instance
amb
(@NonNull Iterable<@NonNull ? extends CompletableSource>
the Iterable 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 in the Iterable sequence terminates (normally or with an error) and disposes all other Completables.

public static @NonNull Completable

Returns:

the new Completable instance
ambArray
(@NonNull 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 @NonNull Completable

Returns:

the new Completable instance
ambWith
(@NonNull CompletableSource
the other CompletableSource, 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 CompletableSource, whichever fires first.

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

Returns:

the new Observable that composes this Completable and the next ObservableSource
andThen
(@NonNull ObservableSource<T>
the ObservableSource 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
>
@NonNull Flowable<T>

Returns:

the new Flowable that composes this Completable and the next Publisher
andThen
(@NonNull 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 Publisher.

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

Returns:

the new Single that composes this Completable and the next SingleSource
andThen
(@NonNull SingleSource<T>
the SingleSource 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
>
@NonNull Maybe<T>

Returns:

the new Maybe that composes this Completable and the next MaybeSource
andThen
(@NonNull MaybeSource<T>
the MaybeSource 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 @NonNull Completable

Returns:

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

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

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
,
@NonNull 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 void
blockingSubscribe()

Subscribes to the current Completable and blocks the current thread until it terminates.

public final void
blockingSubscribe(@NonNull Action
the Action to call if the current Completable completes normally
onComplete
)

Subscribes to the current Completable and calls given onComplete callback on the current thread when it completes normally.

public final void
blockingSubscribe(@NonNull Action
the Action to call if the current Completable completes normally
onComplete
,
@NonNull Consumer<? super Throwable>
the Consumer to call if the current Completable signals an error
onError
)

Subscribes to the current Completable and calls the appropriate callback on the current thread when it terminates.

public final void
blockingSubscribe(@NonNull CompletableObserver
the CompletableObserver to call methods on the current thread
observer
)

Subscribes to the current Completable and calls the appropriate CompletableObserver method on the current thread.

public final @NonNull 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 @NonNull Completable

Returns:

the shared Completable instance
complete
()

Returns a Completable instance that completes immediately when subscribed to.

public final @NonNull Completable

Returns:

the new Completable instance
compose
(@NonNull CompletableTransformer
the transformer function, not null
transformer
)

Calls the given transformer function with this instance and returns the function's resulting CompletableSource wrapped with wrap(CompletableSource).

public static @NonNull Completable

Returns:

the new Completable instance
concat
(@NonNull Iterable<@NonNull ? extends CompletableSource>
the sources to concatenate
sources
)

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

public static @NonNull Completable

Returns:

the new Completable instance
concat
(@NonNull Publisher<@NonNull ? extends CompletableSource>
the sources to concatenate
sources
)

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

public static @NonNull Completable

Returns:

the new Completable instance
concat
(@NonNull Publisher<@NonNull ? 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 @NonNull Completable

Returns:

the new Completable instance
concatArray
(@NonNull CompletableSource...
the sources to concatenate
sources
)

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

public static @NonNull Completable

Returns:

the new Completable instance
concatArrayDelayError
(@NonNull CompletableSource...
the sources to concatenate
sources
)

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

public static @NonNull Completable

Returns:

the new Completable instance
concatDelayError
(@NonNull Iterable<@NonNull ? extends CompletableSource>
the sources to concatenate
sources
)

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

public static @NonNull Completable

Returns:

the new Completable instance
concatDelayError
(@NonNull Publisher<@NonNull ? extends CompletableSource>
the sources to concatenate
sources
)

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

public static @NonNull Completable

Returns:

the new Completable instance
concatDelayError
(@NonNull Publisher<@NonNull ? 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 final @NonNull Completable

Returns:

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

Concatenates this Completable with another CompletableSource.

public static @NonNull Completable

Returns:

the new Completable instance
create
(@NonNull 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 @NonNull Completable

Returns:

the new Completable instance
defer
(@NonNull Supplier<? extends @NonNull CompletableSource>
the supplier that returns the Completable that will be subscribed to.
supplier
)

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

public final @NonNull Completable

Returns:

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

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

public final @NonNull Completable

Returns:

the new Completable instance
delay
(long
the delay time
time
,
@NonNull TimeUnit
the delay unit
unit
,
@NonNull 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 @NonNull Completable

Returns:

the new Completable instance
delay
(long
the delay time
time
,
@NonNull TimeUnit
the delay unit
unit
,
@NonNull Scheduler
the Scheduler to run the delayed completion on
scheduler
,
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 @NonNull Completable

Returns:

the new Completable instance
delaySubscription
(long
the time to delay the subscription
time
,
@NonNull TimeUnit
the time unit of delay
unit
)

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

public final @NonNull Completable

Returns:

the new Completable instance
delaySubscription
(long
the time to delay the subscription
time
,
@NonNull TimeUnit
the time unit of delay
unit
,
@NonNull Scheduler
the Scheduler on which the waiting and subscription will happen
scheduler
)

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

public final @NonNull Completable

Returns:

the new Completable instance
doAfterTerminate
(@NonNull Action
the Action to call after this Completable terminates
onAfterTerminate
)

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

public final @NonNull Completable

Returns:

the new Completable instance
doFinally
(@NonNull 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 @NonNull Completable

Returns:

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

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

public final @NonNull Completable

Returns:

the new Completable instance
doOnDispose
(@NonNull Action
the Action to call when the downstream observer 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 @NonNull Completable

Returns:

the new Completable instance
doOnError
(@NonNull Consumer<? super Throwable>
the error Consumer receiving the upstream Throwable if the upstream signals it via onError
onError
)

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

public final @NonNull Completable

Returns:

the new Completable instance
doOnEvent
(@NonNull Consumer<@Nullable ? super Throwable>
the event Consumer that receives null for upstream completion or a Throwable if the upstream signaled an error
onEvent
)

Returns a Completable which calls the given onEvent Consumer with the Throwable for an onError or null for an onComplete signal from this Completable before delivering the signal to the downstream.

public final @NonNull Completable

Returns:

the new Completable instance
doOnLifecycle
(@NonNull Consumer<? super Disposable> onSubscribe, @NonNull Action
called when the downstream disposes the Disposable via dispose()
onDispose
)

Calls the appropriate onXXX method (shared between all CompletableObservers) for the lifecycle events of the sequence (subscription, disposal).

private @NonNull Completable

Returns:

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

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

public final @NonNull Completable

Returns:

the new Completable instance
doOnSubscribe
(@NonNull Consumer<? super Disposable>
the Consumer called when a downstream CompletableObserver subscribes
onSubscribe
)

Returns a Completable instance that calls the given onSubscribe callback with the disposable that the downstream CompletableObservers receive upon subscription.

public final @NonNull Completable

Returns:

the new Completable instance
doOnTerminate
(@NonNull Action
the Action to call just before this Completable terminates
onTerminate
)

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

public static @NonNull Completable

Returns:

the new Completable instance
error
(@NonNull Supplier<? extends @NonNull Throwable>
the error supplier, not null
supplier
)

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

public static @NonNull Completable

Returns:

the new Completable instance
error
(@NonNull Throwable
the Throwable instance to emit, not null
throwable
)

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

public static @NonNull Completable

Returns:

the new Completable instance
fromAction
(@NonNull Action
the Action to run for each subscribing CompletableObserver
action
)

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

public static @NonNull Completable

Returns:

the new Completable instance
fromCallable
(@NonNull Callable<?>
the Callable instance to execute for each subscribing CompletableObserver
callable
)

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

public static @NonNull Completable

Returns:

the new Completable instance
fromCompletionStage
(@NonNull CompletionStage<?>
the CompletionStage to convert to a Completable and signal onComplete or onError when the CompletionStage terminates normally or with a failure
stage
)

Signals completion (or error) when the CompletionStage terminates.

public static @NonNull Completable

Returns:

the new Completable instance
fromFuture
(@NonNull 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
>
@NonNull Completable

Returns:

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

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

public static <
the type of the ObservableSource
T
>
@NonNull Completable

Returns:

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

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

public static <
the type of the Publisher
T
>
@NonNull Completable

Returns:

the new Completable instance
fromPublisher
(@NonNull 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 @NonNull Completable

Returns:

the new Completable instance
fromRunnable
(@NonNull Runnable
the Runnable to run for each CompletableObserver
run
)

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

public static <
the value type of the SingleSource
T
>
@NonNull Completable

Returns:

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

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

public static @NonNull Completable

Returns:

the new Completable instance
fromSupplier
(@NonNull Supplier<?>
the Supplier instance to execute for each CompletableObserver
supplier
)

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

public final @NonNull Completable

Returns:

the new Completable instance
hide
()

Hides the identity of this Completable and its Disposable.

public final @NonNull Completable

Returns:

the new Completable instance
lift
(@NonNull 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
>
@NonNull 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 @NonNull Completable

Returns:

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

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

public static @NonNull Completable

Returns:

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

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

public static @NonNull Completable

Returns:

the new Completable instance
merge
(@NonNull Publisher<@NonNull ? extends CompletableSource>
the Publisher sequence of CompletableSources.
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 CompletableSources complete or one of them emits an error.

private static @NonNull Completable

Returns:

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

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

public static @NonNull Completable

Returns:

the new Completable instance
mergeArray
(@NonNull CompletableSource...
the array of CompletableSources.
sources
)

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

public static @NonNull Completable

Returns:

the new Completable instance
mergeArrayDelayError
(@NonNull CompletableSource...
the array of CompletableSources
sources
)

Returns a Completable that subscribes to all CompletableSources in the source array and delays any error emitted by any of the inner CompletableSources until all of them terminate in a way or another.

public static @NonNull Completable

Returns:

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

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

public static @NonNull Completable

Returns:

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

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

public static @NonNull Completable

Returns:

the new Completable instance
mergeDelayError
(@NonNull Publisher<@NonNull ? extends CompletableSource>
the sequence of CompletableSources
sources
,
int
the maximum number of concurrent subscriptions to have at a time to the inner CompletableSources
maxConcurrency
)

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

public final @NonNull Completable

Returns:

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

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

public static @NonNull Completable

Returns:

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

Returns a Completable that never calls onError or onComplete.

public final @NonNull Completable

Returns:

the new Completable instance
observeOn
(@NonNull 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 @NonNull 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 upstream Throwable.

public final @NonNull Completable

Returns:

the new Completable instance
onErrorComplete
(@NonNull Predicate<? super Throwable>
the Predicate to call when a 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 @NonNull Completable

Returns:

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

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

public final @NonNull Completable

Returns:

the new Completable instance
onErrorResumeWith
(@NonNull CompletableSource
the next CompletableSource that will take over if the current Completable encounters an error
fallback
)

Resumes the flow with the given CompletableSource when the current Completable fails instead of signaling the error via onError.

public final <
the item type to return on error
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
onErrorReturn
(@NonNull Function<? super Throwable, ? extends T>
a function that returns a single value that will be emitted as success value the current Completable signals an onError event
itemSupplier
)

Ends the flow with a success item returned by a function for the Throwable error signaled by the current Completable instead of signaling the error via onError.

public final <
the item type to return on error
T
>
@NonNull Maybe<T>

Returns:

the new Maybe instance
onErrorReturnItem
(T
the value that is emitted as onSuccess in case the current Completable signals an onError
item
)

Ends the flow with the given success item when the current Completable fails instead of signaling the error via onError.

public final @NonNull Completable

Returns:

the new Completable instance
onTerminateDetach
()

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

public final @NonNull Completable

Returns:

the new Completable instance
repeat
()

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

public final @NonNull Completable

Returns:

the new Completable instance
repeat
(long
the number of times the re-subscription should happen
times
)

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

public final @NonNull Completable

Returns:

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

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

public final @NonNull Completable

Returns:

the new Completable instance
repeatWhen
(@NonNull Function<? super Flowable<Object>, @NonNull ? extends Publisher<@NonNull ?>>
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 Function emits an item or completes when this Publisher emits an onComplete event.

public final @NonNull Completable

Returns:

the new Completable instance
retry
()

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

public final @NonNull Completable

Returns:

the new Completable instance
retry
(@NonNull BiPredicate<? super Integer, ? super Throwable>
the Predicate called when this Completable emits an error with the repeat count and the latest Throwable 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 @NonNull 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 @NonNull Completable

Returns:

the new Completable instance
retry
(long
the number of times to resubscribe if the current Completable fails
times
,
@NonNull 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 @NonNull Completable

Returns:

the new Completable instance
retry
(@NonNull 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 Throwable to decide whether to resubscribe to the upstream or not.

public final @NonNull Completable

Returns:

the new Completable instance
retryUntil
(@NonNull BooleanSupplier
the function that should return true to stop retrying
stop
)

Retries until the given stop function returns true.

public final @NonNull Completable

Returns:

the new Completable instance
retryWhen
(@NonNull Function<? super Flowable<Throwable>, @NonNull ? extends Publisher<@NonNull ?>>
the Function 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 void
safeSubscribe(@NonNull CompletableObserver
the potentially misbehaving CompletableObserver
observer
)

Wraps the given CompletableObserver, catches any RuntimeExceptions thrown by its CompletableObserver#onSubscribe(Disposable), CompletableObserver#onError(Throwable) or CompletableObserver#onComplete() methods and routes those to the global error handler via RxJavaPlugins#onError(Throwable).

public static @NonNull Single<Boolean>

Returns:

the new Single instance
sequenceEqual
(@NonNull CompletableSource
the first CompletableSource instance
source1
,
@NonNull CompletableSource
the second CompletableSource instance
source2
)

Compares two CompletableSources and emits true via a Single if both complete.

public final @NonNull Completable

Returns:

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

Returns a Completable which first runs the other CompletableSource then the current Completable if the other completed normally.

public final <
the element type of the other SingleSource.
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
startWith
(@NonNull SingleSource<T>
the other SingleSource to run first
other
)

Returns a Flowable which first runs the other SingleSource then the current Completable if the other succeeded normally.

public final <
the element type of the other MaybeSource.
T
>
@NonNull Flowable<T>

Returns:

the new Flowable instance
startWith
(@NonNull MaybeSource<T>
the other MaybeSource to run first
other
)

Returns a Flowable which first runs the other MaybeSource then the current Completable if the other succeeded or completed normally.

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

Returns:

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

Returns an Observable which first delivers the events of the other ObservableSource then runs the current Completable.

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

Returns:

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

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

public final @NonNull Disposable

Returns:

the new Disposable that can be used for disposing the subscription at any time
subscribe
()

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

public final void
public final @NonNull Disposable

Returns:

the new Disposable that can be used for disposing the subscription at any time
subscribe
(@NonNull Action
the Action that is called if the Completable completes normally
onComplete
,
@NonNull 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 @NonNull Disposable

Returns:

the Disposable that allows disposing the particular subscription.
subscribe
(@NonNull Action
the callback for an upstream completion
onComplete
,
@NonNull Consumer<? super Throwable>
the callback for an upstream error
onError
,
@NonNull DisposableContainer
the DisposableContainer (such as CompositeDisposable) to add and remove the created Disposable CompletableObserver
container
)

Wraps the given onXXX callbacks into a Disposable CompletableObserver, adds it to the given DisposableContainer and ensures, that if the upstream terminates or this particular Disposable is disposed, the CompletableObserver is removed from the given composite.

public final @NonNull Disposable

Returns:

the new Disposable that can be used for disposing the subscription at any time
subscribe
(@NonNull Action
the Action 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(@NonNull 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 @NonNull Completable

Returns:

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

Returns a Completable which subscribes the downstream 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 static @NonNull Completable

Returns:

the new Completable instance
switchOnNext
(@NonNull Publisher<@NonNull ? extends CompletableSource>
the Publisher sequence of inner CompletableSources to switch between
sources
)

Switches between CompletableSources emitted by the source Publisher whenever a new CompletableSource is emitted, disposing the previously running CompletableSource, exposing the setup as a Completable sequence.

public static @NonNull Completable

Returns:

the new Completable instance
switchOnNextDelayError
(@NonNull Publisher<@NonNull ? extends CompletableSource>
the Publisher sequence of inner CompletableSources to switch between
sources
)

Switches between CompletableSources emitted by the source Publisher whenever a new CompletableSource is emitted, disposing the previously running CompletableSource, exposing the setup as a Completable sequence and delaying all errors from all of them until all terminate.

public final @NonNull Completable

Returns:

the new Completable instance
takeUntil
(@NonNull 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 @NonNull TestObserver<Void>

Returns:

the new TestObserver instance
test
()

Creates a TestObserver and subscribes it to this Completable.

public final @NonNull 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.
dispose
)

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

public final @NonNull Completable

Returns:

the new Completable instance
timeout
(long
the timeout value
timeout
,
@NonNull TimeUnit
the unit of timeout
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 @NonNull Completable

Returns:

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

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

public final @NonNull Completable

Returns:

the new Completable instance
timeout
(long
the timeout value
timeout
,
@NonNull TimeUnit
the unit of timeout
unit
,
@NonNull Scheduler
the Scheduler to use to wait for completion and signal TimeoutException
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 @NonNull Completable

Returns:

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

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

private @NonNull Completable

Returns:

the new Completable instance
timeout0
(long
the timeout value
timeout
,
TimeUnit
the unit of timeout
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
fallback
)

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

public static @NonNull Completable

Returns:

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

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

public static @NonNull Completable

Returns:

the new Completable instance
timer
(long
the delay time
delay
,
@NonNull TimeUnit
the delay unit
unit
,
@NonNull Scheduler
the Scheduler where to emit the onComplete event
scheduler
)

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

public final <
the resulting object type
R
>
R

Returns:

the converted value
to
(@NonNull CompletableConverter<? extends R>
the CompletableConverter that receives the current Completable instance and returns a value to be the result of to()
converter
)

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

public final <
the type of the default item to signal upon completion
T
>
@NonNull CompletionStage<T>

Returns:

the new CompletionStage instance
toCompletionStage
(T
the item to signal upon completion
defaultItem
)

Signals the given default item when the upstream completes or signals the upstream error via a CompletionStage.

public final <
the value type
T
>
@NonNull 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 downstream Subscriber.

public final @NonNull Future<Void>

Returns:

the new Future instance
toFuture
()

Returns a Future representing the termination of the current Completable via a null value.

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

Returns:

the new Maybe instance
toMaybe
()

Converts this Completable into a Maybe.

private static NullPointerException

Returns:

the new 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
>
@NonNull 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 downstream Observer.

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

Returns:

the new Single instance
toSingle
(@NonNull Supplier<? 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
>
@NonNull Single<T>

Returns:

the new Single instance
toSingleDefault
(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 @NonNull Completable

Returns:

the new Completable instance
unsafeCreate
(@NonNull CompletableSource
the callback which will receive the CompletableObserver instances when the Completable is subscribed to.
onSubscribe
)

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 @NonNull Completable

Returns:

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

Returns a Completable which makes sure when an observer disposes the subscription, the dispose() method is called on the specified Scheduler.

public static <
the resource type
R
>
@NonNull Completable

Returns:

the new Completable instance
using
(@NonNull Supplier<R>
the Supplier that returns a resource to be managed.
resourceSupplier
,
@NonNull Function<? super R, ? extends CompletableSource>
the Function that given a resource returns a CompletableSource instance that will be subscribed to
sourceSupplier
,
@NonNull Consumer<? super R>
the Consumer that disposes the resource created by the resource supplier
resourceCleanup
)

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

public static <
the resource type
R
>
@NonNull Completable

Returns:

the new Completable instance
using
(@NonNull Supplier<R>
the Supplier that returns a resource to be managed
resourceSupplier
,
@NonNull Function<? super R, ? extends CompletableSource>
the Function that given a resource returns a non-null CompletableSource instance that will be subscribed to
sourceSupplier
,
@NonNull Consumer<? super R>
the Consumer that disposes the resource created by the resource supplier
resourceCleanup
,
boolean
If true then resource disposal will happen either on a dispose() call before the upstream is disposed or just before the emission of a terminal event (onComplete or onError). If false the resource disposal will happen either on a dispose() call after the upstream is disposed or just after the emission of a terminal event (onComplete or onError).
eager
)

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

public static @NonNull Completable

Returns:

the new wrapped or cast Completable instance
wrap
(@NonNull CompletableSource
the source to wrap
source
)

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait