KEMBAR78
Completable (RxJava Javadoc 2.0.8)
io.reactivex

Class Completable

  • All Implemented Interfaces:
    CompletableSource
    Direct Known Subclasses:
    CompletableSubject


    public abstract class Completable
    extends java.lang.Object
    implements CompletableSource
    Represents a deferred computation without any value but only indication for completion or exception. The class follows a similar event pattern as Reactive-Streams: onSubscribe (onError|onComplete)?
    • Constructor Summary

      Constructors 
      Constructor and Description
      Completable() 
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      static Completable amb(java.lang.Iterable<? extends CompletableSource> sources)
      Returns a Completable which terminates as soon as one of the source Completables terminates (normally or with an error) and cancels all other Completables.
      static Completable ambArray(CompletableSource... sources)
      Returns a Completable which terminates as soon as one of the source Completables terminates (normally or with an error) and cancels all other Completables.
      Completable ambWith(CompletableSource other)
      Returns a Completable that emits the a terminated event of either this Completable or the other Completable whichever fires first.
      Completable andThen(CompletableSource next)
      Returns a Completable that first runs this Completable and then the other completable.
      <T> Maybe<T> andThen(MaybeSource<T> next)
      Returns a Maybe which will subscribe to this Completable and once that is completed then will subscribe to the next MaybeSource.
      <T> Observable<T> andThen(ObservableSource<T> next)
      Returns an Observable which will subscribe to this Completable and once that is completed then will subscribe to the next ObservableSource.
      <T> Flowable<T> andThen(org.reactivestreams.Publisher<T> next)
      Returns a Flowable which will subscribe to this Completable and once that is completed then will subscribe to the next Flowable.
      <T> Single<T> andThen(SingleSource<T> next)
      Returns a Single which will subscribe to this Completable and once that is completed then will subscribe to the next SingleSource.
      void blockingAwait()
      Subscribes to and awaits the termination of this Completable instance in a blocking manner and rethrows any exception emitted.
      boolean blockingAwait(long timeout, java.util.concurrent.TimeUnit 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.
      java.lang.Throwable blockingGet()
      Subscribes to this Completable instance and blocks until it terminates, then returns null or the emitted exception if any.
      java.lang.Throwable blockingGet(long timeout, java.util.concurrent.TimeUnit 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.
      Completable 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.
      static Completable complete()
      Returns a Completable instance that completes immediately when subscribed to.
      Completable compose(CompletableTransformer transformer)
      Calls the given transformer function with this instance and returns the function's resulting Completable.
      static Completable concat(java.lang.Iterable<? extends CompletableSource> sources)
      Returns a Completable which completes only when all sources complete, one after another.
      static Completable concat(org.reactivestreams.Publisher<? extends CompletableSource> sources)
      Returns a Completable which completes only when all sources complete, one after another.
      static Completable concat(org.reactivestreams.Publisher<? extends CompletableSource> sources, int prefetch)
      Returns a Completable which completes only when all sources complete, one after another.
      static Completable concatArray(CompletableSource... sources)
      Returns a Completable which completes only when all sources complete, one after another.
      Completable concatWith(CompletableSource other)
      Concatenates this Completable with another Completable.
      static Completable create(CompletableOnSubscribe source)
      Provides an API (via a cold Completable) that bridges the reactive world with the callback-style world.
      static Completable defer(java.util.concurrent.Callable<? extends CompletableSource> completableSupplier)
      Defers the subscription to a Completable instance returned by a supplier.
      Completable delay(long delay, java.util.concurrent.TimeUnit unit)
      Returns a Completable which delays the emission of the completion event by the given time.
      Completable delay(long delay, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
      Returns a Completable which delays the emission of the completion event by the given time while running on the specified scheduler.
      Completable delay(long delay, java.util.concurrent.TimeUnit unit, Scheduler scheduler, boolean 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.
      Completable doAfterTerminate(Action onAfterTerminate)
      Returns a Completable instance that calls the given onTerminate callback after this Completable completes normally or with an exception Scheduler: doAfterTerminate does not operate by default on a particular Scheduler.
      Completable doFinally(Action onFinally)
      Calls the specified action after this Completable signals onError or onComplete or gets disposed by the downstream.
      Completable doOnComplete(Action onComplete)
      Returns a Completable which calls the given onComplete callback if this Completable completes.
      Completable doOnDispose(Action onDispose)
      Returns a Completable which calls the given onDispose callback if the child subscriber cancels the subscription.
      Completable doOnError(Consumer<? super java.lang.Throwable> onError)
      Returns a Completable which calls the given onError callback if this Completable emits an error.
      Completable doOnEvent(Consumer<? super java.lang.Throwable> 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.
      Completable doOnSubscribe(Consumer<? super Disposable> onSubscribe)
      Returns a Completable instance that calls the given onSubscribe callback with the disposable that child subscribers receive on subscription.
      Completable doOnTerminate(Action onTerminate)
      Returns a Completable instance that calls the given onTerminate callback just before this Completable completes normally or with an exception Scheduler: doOnTerminate does not operate by default on a particular Scheduler.
      static Completable error(java.util.concurrent.Callable<? extends java.lang.Throwable> errorSupplier)
      Creates a Completable which calls the given error supplier for each subscriber and emits its returned Throwable.
      static Completable error(java.lang.Throwable error)
      Creates a Completable instance that emits the given Throwable exception to subscribers.
      static Completable fromAction(Action run)
      Returns a Completable instance that runs the given Action for each subscriber and emits either an unchecked exception or simply completes.
      static Completable fromCallable(java.util.concurrent.Callable<?> callable)
      Returns a Completable which when subscribed, executes the callable function, ignores its normal result and emits onError or onComplete only.
      static Completable fromFuture(java.util.concurrent.Future<?> future)
      Returns a Completable instance that reacts to the termination of the given Future in a blocking fashion.
      static <T> Completable fromObservable(ObservableSource<T> observable)
      Returns a Completable instance that subscribes to the given Observable, ignores all values and emits only the terminal event.
      static <T> Completable fromPublisher(org.reactivestreams.Publisher<T> publisher)
      Returns a Completable instance that subscribes to the given publisher, ignores all values and emits only the terminal event.
      static Completable fromRunnable(java.lang.Runnable run)
      Returns a Completable instance that runs the given Runnable for each subscriber and emits either its exception or simply completes.
      static <T> Completable fromSingle(SingleSource<T> 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.
      Completable hide()
      Hides the identity of this Completable and its Disposable.
      Completable lift(CompletableOperator onLift)
      Advanced use without safeguards: lifts a CompletableOperator transformation into the chain of Completables.
      static Completable merge(java.lang.Iterable<? extends CompletableSource> 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.
      static Completable merge(org.reactivestreams.Publisher<? extends CompletableSource> 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.
      static Completable merge(org.reactivestreams.Publisher<? extends CompletableSource> sources, int 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.
      static Completable mergeArray(CompletableSource... 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.
      static Completable mergeArrayDelayError(CompletableSource... 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.
      static Completable mergeDelayError(java.lang.Iterable<? extends CompletableSource> 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.
      static Completable mergeDelayError(org.reactivestreams.Publisher<? extends CompletableSource> 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.
      static Completable mergeDelayError(org.reactivestreams.Publisher<? extends CompletableSource> sources, int 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.
      Completable mergeWith(CompletableSource other)
      Returns a Completable which subscribes to this and the other Completable and completes when both of them complete or one emits an error.
      static Completable never()
      Returns a Completable that never calls onError or onComplete.
      Completable observeOn(Scheduler scheduler)
      Returns a Completable which emits the terminal events from the thread of the specified scheduler.
      Completable onErrorComplete()
      Returns a Completable instance that if this Completable emits an error, it will emit an onComplete and swallow the throwable.
      Completable onErrorComplete(Predicate<? super java.lang.Throwable> 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.
      Completable onErrorResumeNext(Function<? super java.lang.Throwable,? extends CompletableSource> 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.
      Completable repeat()
      Returns a Completable that repeatedly subscribes to this Completable until cancelled.
      Completable repeat(long times)
      Returns a Completable that subscribes repeatedly at most the given times to this Completable.
      Completable repeatUntil(BooleanSupplier stop)
      Returns a Completable that repeatedly subscribes to this Completable so long as the given stop supplier returns false.
      Completable repeatWhen(Function<? super Flowable<java.lang.Object>,? extends org.reactivestreams.Publisher<?>> 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.
      Completable retry()
      Returns a Completable that retries this Completable as long as it emits an onError event.
      Completable retry(BiPredicate<? super java.lang.Integer,? super java.lang.Throwable> predicate)
      Returns a Completable that retries this Completable in case of an error as long as the predicate returns true.
      Completable retry(long 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.
      Completable retry(Predicate<? super java.lang.Throwable> 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.
      Completable retryWhen(Function<? super Flowable<java.lang.Throwable>,? extends org.reactivestreams.Publisher<?>> 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.
      Completable startWith(CompletableSource other)
      Returns a Completable which first runs the other Completable then this completable if the other completed normally.
      <T> Observable<T> startWith(Observable<T> other)
      Returns an Observable which first delivers the events of the other Observable then runs this CompletableConsumable.
      <T> Flowable<T> startWith(org.reactivestreams.Publisher<T> other)
      Returns a Flowable which first delivers the events of the other Publisher then runs this Completable.
      Disposable subscribe()
      Subscribes to this CompletableConsumable and returns a Disposable which can be used to cancel the subscription.
      Disposable subscribe(Action onComplete)
      Subscribes to this Completable and calls the given Action when this Completable completes normally.
      Disposable subscribe(Action onComplete, Consumer<? super java.lang.Throwable> onError)
      Subscribes to this Completable and calls back either the onError or onComplete functions.
      void subscribe(CompletableObserver s)
      Subscribes the given CompletableObserver to this CompletableSource instance.
      protected abstract void subscribeActual(CompletableObserver s)
      Implement this to handle the incoming CompletableObserver and perform the business logic in your operator.
      Completable subscribeOn(Scheduler 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.
      <E extends CompletableObserver
      E
      subscribeWith(E observer)
      Subscribes a given CompletableObserver (subclass) to this Completable and returns the given CompletableObserver as is.
      TestObserver<java.lang.Void> test()
      Creates a TestObserver and subscribes it to this Completable.
      TestObserver<java.lang.Void> test(boolean cancelled)
      Creates a TestObserver optionally in cancelled state, then subscribes it to this Completable.
      Completable timeout(long timeout, java.util.concurrent.TimeUnit unit)
      Returns a Completable that runs this Completable and emits a TimeoutException in case this Completable doesn't complete within the given time.
      Completable timeout(long timeout, java.util.concurrent.TimeUnit unit, CompletableSource 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.
      Completable timeout(long timeout, java.util.concurrent.TimeUnit unit, Scheduler 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.
      Completable timeout(long timeout, java.util.concurrent.TimeUnit unit, Scheduler scheduler, CompletableSource 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.
      static Completable timer(long delay, java.util.concurrent.TimeUnit unit)
      Returns a Completable instance that fires its onComplete event after the given delay elapsed.
      static Completable timer(long delay, java.util.concurrent.TimeUnit unit, Scheduler scheduler)
      Returns a Completable instance that fires its onComplete event after the given delay elapsed by using the supplied scheduler.
      <U> U to(Function<? super Completable,U> converter)
      Allows fluent conversion to another type via a function callback.
      <T> Flowable<T> toFlowable()
      Returns a Flowable which when subscribed to subscribes to this Completable and relays the terminal events to the subscriber.
      <T> Maybe<T> toMaybe()
      Converts this Completable into a Maybe.
      <T> Observable<T> toObservable()
      Returns an Observable which when subscribed to subscribes to this Completable and relays the terminal events to the subscriber.
      <T> Single<T> toSingle(java.util.concurrent.Callable<? extends T> completionValueSupplier)
      Converts this Completable into a Single which when this Completable completes normally, calls the given supplier and emits its returned value through onSuccess.
      <T> Single<T> toSingleDefault(T completionValue)
      Converts this Completable into a Single which when this Completable completes normally, emits the given value through onSuccess.
      static Completable unsafeCreate(CompletableSource source)
      Constructs a Completable instance by wrapping the given source callback without any safeguards; you should manage the lifecycle and response to downstream cancellation/dispose.
      Completable unsubscribeOn(Scheduler scheduler)
      Returns a Completable which makes sure when a subscriber cancels the subscription, the dispose is called on the specified scheduler Scheduler: unsubscribeOn calls dispose() of the upstream on the Scheduler you specify.
      static <R> Completable using(java.util.concurrent.Callable<R> resourceSupplier, Function<? super R,? extends CompletableSource> completableFunction, Consumer<? super R> disposer)
      Returns a Completable instance which manages a resource along with a custom Completable instance while the subscription is active.
      static <R> Completable using(java.util.concurrent.Callable<R> resourceSupplier, Function<? super R,? extends CompletableSource> completableFunction, Consumer<? super R> disposer, boolean 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.
      static Completable wrap(CompletableSource source)
      Wraps the given CompletableSource into a Completable if not already Completable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Completable

        public Completable()
    • Method Detail

      • ambArray

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable ambArray(CompletableSource... sources)
        Returns a Completable which terminates as soon as one of the source Completables terminates (normally or with an error) and cancels all other Completables.
        Scheduler:
        ambArray does not operate by default on a particular Scheduler.
        Parameters:
        sources - the array of source Completables. A subscription to each source will occur in the same order as in this array.
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if sources is null
      • amb

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable amb(java.lang.Iterable<? extends CompletableSource> sources)
        Returns a Completable which terminates as soon as one of the source Completables terminates (normally or with an error) and cancels all other Completables.
        Scheduler:
        amb does not operate by default on a particular Scheduler.
        Parameters:
        sources - the array of source Completables. A subscription to each source will occur in the same order as in this Iterable.
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if sources is null
      • complete

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable complete()
        Returns a Completable instance that completes immediately when subscribed to.
        Scheduler:
        complete does not operate by default on a particular Scheduler.
        Returns:
        a Completable instance that completes immediately
      • concatArray

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable concatArray(CompletableSource... sources)
        Returns a Completable which completes only when all sources complete, one after another.
        Scheduler:
        concatArray does not operate by default on a particular Scheduler.
        Parameters:
        sources - the sources to concatenate
        Returns:
        the Completable instance which completes only when all sources complete
        Throws:
        java.lang.NullPointerException - if sources is null
      • concat

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable concat(java.lang.Iterable<? extends CompletableSource> sources)
        Returns a Completable which completes only when all sources complete, one after another.
        Scheduler:
        concat does not operate by default on a particular Scheduler.
        Parameters:
        sources - the sources to concatenate
        Returns:
        the Completable instance which completes only when all sources complete
        Throws:
        java.lang.NullPointerException - if sources is null
      • concat

        @CheckReturnValue
        @SchedulerSupport(value="none")
        @BackpressureSupport(value=FULL)
        public static Completable concat(org.reactivestreams.Publisher<? extends CompletableSource> sources)
        Returns a Completable which completes only when all sources complete, one after another.
        Backpressure:
        The returned Completable honors the backpressure of the downstream consumer and expects the other Publisher to honor it as well.
        Scheduler:
        concat does not operate by default on a particular Scheduler.
        Parameters:
        sources - the sources to concatenate
        Returns:
        the Completable instance which completes only when all sources complete
        Throws:
        java.lang.NullPointerException - if sources is null
      • concat

        @CheckReturnValue
        @SchedulerSupport(value="none")
        @BackpressureSupport(value=FULL)
        public static Completable concat(org.reactivestreams.Publisher<? extends CompletableSource> sources,
                                                                                             int prefetch)
        Returns a Completable which completes only when all sources complete, one after another.
        Backpressure:
        The returned Completable honors the backpressure of the downstream consumer and expects the other Publisher to honor it as well.
        Scheduler:
        concat does not operate by default on a particular Scheduler.
        Parameters:
        sources - the sources to concatenate
        prefetch - the number of sources to prefetch from the sources
        Returns:
        the Completable instance which completes only when all sources complete
        Throws:
        java.lang.NullPointerException - if sources is null
      • create

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable create(CompletableOnSubscribe source)
        Provides an API (via a cold Completable) that bridges the reactive world with the callback-style world.

        Example:

        
         Completable.create(emitter -> {
             Callback listener = new Callback() {
                 @Override
                 public void onEvent(Event e) {
                     emitter.onComplete();
                 }
        
                 @Override
                 public void onFailure(Exception e) {
                     emitter.onError(e);
                 }
             };
        
             AutoCloseable c = api.someMethod(listener);
        
             emitter.setCancellable(c::close);
        
         });
         

        Scheduler:
        create does not operate by default on a particular Scheduler.
        Parameters:
        source - the emitter that is called when a CompletableObserver subscribes to the returned Completable
        Returns:
        the new Completable instance
        See Also:
        CompletableOnSubscribe, Cancellable
      • unsafeCreate

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable unsafeCreate(CompletableSource source)
        Constructs a Completable instance by wrapping the given source callback without any safeguards; you should manage the lifecycle and response to downstream cancellation/dispose.
        Scheduler:
        unsafeCreate does not operate by default on a particular Scheduler.
        Parameters:
        source - the callback which will receive the CompletableObserver instances when the Completable is subscribed to.
        Returns:
        the created Completable instance
        Throws:
        java.lang.NullPointerException - if source is null
      • defer

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable defer(java.util.concurrent.Callable<? extends CompletableSource> completableSupplier)
        Defers the subscription to a Completable instance returned by a supplier.
        Scheduler:
        defer does not operate by default on a particular Scheduler.
        Parameters:
        completableSupplier - the supplier that returns the Completable that will be subscribed to.
        Returns:
        the Completable instance
      • error

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable error(java.util.concurrent.Callable<? extends java.lang.Throwable> errorSupplier)
        Creates a Completable which calls the given error supplier for each subscriber and emits its returned Throwable.

        If the errorSupplier returns null, the child CompletableObservers will receive a NullPointerException.

        Scheduler:
        error does not operate by default on a particular Scheduler.
        Parameters:
        errorSupplier - the error supplier, not null
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if errorSupplier is null
      • error

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable error(java.lang.Throwable error)
        Creates a Completable instance that emits the given Throwable exception to subscribers.
        Scheduler:
        error does not operate by default on a particular Scheduler.
        Parameters:
        error - the Throwable instance to emit, not null
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if error is null
      • fromAction

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable fromAction(Action run)
        Returns a Completable instance that runs the given Action for each subscriber and emits either an unchecked exception or simply completes.
        Scheduler:
        fromAction does not operate by default on a particular Scheduler.
        Parameters:
        run - the runnable to run for each subscriber
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if run is null
      • fromCallable

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable fromCallable(java.util.concurrent.Callable<?> callable)
        Returns a Completable which when subscribed, executes the callable function, ignores its normal result and emits onError or onComplete only.
        Scheduler:
        fromCallable does not operate by default on a particular Scheduler.
        Parameters:
        callable - the callable instance to execute for each subscriber
        Returns:
        the new Completable instance
      • fromFuture

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable fromFuture(java.util.concurrent.Future<?> future)
        Returns a Completable instance that reacts to the termination of the given Future in a blocking fashion.

        Note that cancellation from any of the subscribers to this Completable will cancel the future.

        Scheduler:
        fromFuture does not operate by default on a particular Scheduler.
        Parameters:
        future - the future to react to
        Returns:
        the new Completable instance
      • fromRunnable

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable fromRunnable(java.lang.Runnable run)
        Returns a Completable instance that runs the given Runnable for each subscriber and emits either its exception or simply completes.
        Scheduler:
        fromRunnable does not operate by default on a particular Scheduler.
        Parameters:
        run - the runnable to run for each subscriber
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if run is null
      • fromObservable

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static <T> Completable fromObservable(ObservableSource<T> observable)
        Returns a Completable instance that subscribes to the given Observable, ignores all values and emits only the terminal event.
        Scheduler:
        fromObservable does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the type of the Observable
        Parameters:
        observable - the Observable instance to subscribe to, not null
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if flowable is null
      • fromPublisher

        @CheckReturnValue
        @BackpressureSupport(value=UNBOUNDED_IN)
        @SchedulerSupport(value="none")
        public static <T> Completable fromPublisher(org.reactivestreams.Publisher<T> publisher)
        Returns a Completable instance that subscribes to the given publisher, ignores all values and emits only the terminal event.
        Backpressure:
        The returned Completable honors the backpressure of the downstream consumer and expects the other Publisher to honor it as well.
        Scheduler:
        fromPublisher does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the type of the publisher
        Parameters:
        publisher - the Publisher instance to subscribe to, not null
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if publisher is null
      • fromSingle

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static <T> Completable fromSingle(SingleSource<T> 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.
        Scheduler:
        fromSingle does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the value type of the Single
        Parameters:
        single - the Single instance to subscribe to, not null
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if single is null
      • mergeArray

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable mergeArray(CompletableSource... 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.
        Scheduler:
        mergeArray does not operate by default on a particular Scheduler.
        Parameters:
        sources - the iterable sequence of sources.
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if sources is null
      • merge

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable merge(java.lang.Iterable<? extends CompletableSource> 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.
        Scheduler:
        merge does not operate by default on a particular Scheduler.
        Parameters:
        sources - the iterable sequence of sources.
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if sources is null
      • merge

        @CheckReturnValue
        @SchedulerSupport(value="none")
        @BackpressureSupport(value=UNBOUNDED_IN)
        public static Completable merge(org.reactivestreams.Publisher<? extends CompletableSource> 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.
        Backpressure:
        The returned Completable honors the backpressure of the downstream consumer and expects the other Publisher to honor it as well.
        Scheduler:
        merge does not operate by default on a particular Scheduler.
        Parameters:
        sources - the iterable sequence of sources.
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if sources is null
      • merge

        @CheckReturnValue
        @SchedulerSupport(value="none")
        @BackpressureSupport(value=FULL)
        public static Completable merge(org.reactivestreams.Publisher<? extends CompletableSource> sources,
                                                                                            int 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.
        Backpressure:
        The returned Completable honors the backpressure of the downstream consumer and expects the other Publisher to honor it as well.
        Scheduler:
        merge does not operate by default on a particular Scheduler.
        Parameters:
        sources - the iterable sequence of sources.
        maxConcurrency - the maximum number of concurrent subscriptions
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if sources is null
        java.lang.IllegalArgumentException - if maxConcurrency is less than 1
      • mergeArrayDelayError

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable mergeArrayDelayError(CompletableSource... 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.
        Scheduler:
        mergeArrayDelayError does not operate by default on a particular Scheduler.
        Parameters:
        sources - the array of Completables
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if sources is null
      • mergeDelayError

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable mergeDelayError(java.lang.Iterable<? extends CompletableSource> 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.
        Scheduler:
        mergeDelayError does not operate by default on a particular Scheduler.
        Parameters:
        sources - the sequence of Completables
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if sources is null
      • mergeDelayError

        @CheckReturnValue
        @SchedulerSupport(value="none")
        @BackpressureSupport(value=UNBOUNDED_IN)
        public static Completable mergeDelayError(org.reactivestreams.Publisher<? extends CompletableSource> 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.
        Backpressure:
        The returned Completable honors the backpressure of the downstream consumer and expects the other Publisher to honor it as well.
        Scheduler:
        mergeDelayError does not operate by default on a particular Scheduler.
        Parameters:
        sources - the sequence of Completables
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if sources is null
      • mergeDelayError

        @CheckReturnValue
        @SchedulerSupport(value="none")
        @BackpressureSupport(value=FULL)
        public static Completable mergeDelayError(org.reactivestreams.Publisher<? extends CompletableSource> sources,
                                                                                                      int 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.
        Backpressure:
        The returned Completable honors the backpressure of the downstream consumer and expects the other Publisher to honor it as well.
        Scheduler:
        mergeDelayError does not operate by default on a particular Scheduler.
        Parameters:
        sources - the sequence of Completables
        maxConcurrency - the maximum number of concurrent subscriptions to Completables
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if sources is null
      • never

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable never()
        Returns a Completable that never calls onError or onComplete.
        Scheduler:
        never does not operate by default on a particular Scheduler.
        Returns:
        the singleton instance that never calls onError or onComplete
      • timer

        @CheckReturnValue
        @SchedulerSupport(value="io.reactivex:computation")
        public static Completable timer(long delay,
                                                               java.util.concurrent.TimeUnit unit)
        Returns a Completable instance that fires its onComplete event after the given delay elapsed.
        Scheduler:
        timer does operate by default on the computation Scheduler.
        Parameters:
        delay - the delay time
        unit - the delay unit
        Returns:
        the new Completable instance
      • timer

        @CheckReturnValue
        @SchedulerSupport(value="custom")
        public static Completable timer(long delay,
                                                               java.util.concurrent.TimeUnit unit,
                                                               Scheduler scheduler)
        Returns a Completable instance that fires its onComplete event after the given delay elapsed by using the supplied scheduler.
        Scheduler:
        timer operates on the Scheduler you specify.
        Parameters:
        delay - the delay time
        unit - the delay unit
        scheduler - the scheduler where to emit the complete event
        Returns:
        the new Completable instance
      • using

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static <R> Completable using(java.util.concurrent.Callable<R> resourceSupplier,
                                                                   Function<? super R,? extends CompletableSource> completableFunction,
                                                                   Consumer<? super R> disposer)
        Returns a Completable instance which manages a resource along with a custom Completable instance while the subscription is active.

        This overload disposes eagerly before the terminal event is emitted.

        Scheduler:
        using does not operate by default on a particular Scheduler.
        Type Parameters:
        R - the resource type
        Parameters:
        resourceSupplier - the supplier that returns a resource to be managed.
        completableFunction - the function that given a resource returns a Completable instance that will be subscribed to
        disposer - the consumer that disposes the resource created by the resource supplier
        Returns:
        the new Completable instance
      • using

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static <R> Completable using(java.util.concurrent.Callable<R> resourceSupplier,
                                                                   Function<? super R,? extends CompletableSource> completableFunction,
                                                                   Consumer<? super R> disposer,
                                                                   boolean 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.

        If this overload performs a lazy cancellation after the terminal event is emitted. Exceptions thrown at this time will be delivered to RxJavaPlugins only.

        Scheduler:
        using does not operate by default on a particular Scheduler.
        Type Parameters:
        R - the resource type
        Parameters:
        resourceSupplier - the supplier that returns a resource to be managed
        completableFunction - the function that given a resource returns a non-null Completable instance that will be subscribed to
        disposer - the consumer that disposes the resource created by the resource supplier
        eager - 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
        Returns:
        the new Completable instance
      • wrap

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public static Completable wrap(CompletableSource source)
        Wraps the given CompletableSource into a Completable if not already Completable.
        Scheduler:
        wrap does not operate by default on a particular Scheduler.
        Parameters:
        source - the source to wrap
        Returns:
        the source or its wrapper Completable
        Throws:
        java.lang.NullPointerException - if source is null
      • ambWith

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable ambWith(CompletableSource other)
        Returns a Completable that emits the a terminated event of either this Completable or the other Completable whichever fires first.
        Scheduler:
        ambWith does not operate by default on a particular Scheduler.
        Parameters:
        other - the other Completable, not null. A subscription to this provided source will occur after subscribing to the current source.
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if other is null
      • andThen

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final <T> Observable<T> andThen(ObservableSource<T> next)
        Returns an Observable which will subscribe to this Completable and once that is completed then will subscribe to the next ObservableSource. An error event from this Completable will be propagated to the downstream subscriber and will result in skipping the subscription of the Observable.
        Scheduler:
        andThen does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the value type of the next ObservableSource
        Parameters:
        next - the Observable to subscribe after this Completable is completed, not null
        Returns:
        Observable that composes this Completable and next
        Throws:
        java.lang.NullPointerException - if next is null
      • andThen

        @CheckReturnValue
        @BackpressureSupport(value=FULL)
        @SchedulerSupport(value="none")
        public final <T> Flowable<T> andThen(org.reactivestreams.Publisher<T> next)
        Returns a Flowable which will subscribe to this Completable and once that is completed then will subscribe to the next Flowable. An error event from this Completable will be propagated to the downstream subscriber and will result in skipping the subscription of the Publisher.
        Backpressure:
        The returned Flowable honors the backpressure of the downstream consumer and expects the other Publisher to honor it as well.
        Scheduler:
        andThen does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the value type of the next Publisher
        Parameters:
        next - the Publisher to subscribe after this Completable is completed, not null
        Returns:
        Flowable that composes this Completable and next
        Throws:
        java.lang.NullPointerException - if next is null
      • andThen

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final <T> Single<T> andThen(SingleSource<T> next)
        Returns a Single which will subscribe to this Completable and once that is completed then will subscribe to the next SingleSource. An error event from this Completable will be propagated to the downstream subscriber and will result in skipping the subscription of the Single.
        Scheduler:
        andThen does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the value type of the next SingleSource
        Parameters:
        next - the Single to subscribe after this Completable is completed, not null
        Returns:
        Single that composes this Completable and next
      • andThen

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final <T> Maybe<T> andThen(MaybeSource<T> next)
        Returns a Maybe which will subscribe to this Completable and once that is completed then will subscribe to the next MaybeSource. An error event from this Completable will be propagated to the downstream subscriber and will result in skipping the subscription of the Maybe.
        Scheduler:
        andThen does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the value type of the next MaybeSource
        Parameters:
        next - the Maybe to subscribe after this Completable is completed, not null
        Returns:
        Maybe that composes this Completable and next
      • blockingAwait

        @SchedulerSupport(value="none")
        public final void blockingAwait()
        Subscribes to and awaits the termination of this Completable instance in a blocking manner and rethrows any exception emitted.
        Scheduler:
        blockingAwait does not operate by default on a particular Scheduler.
        Throws:
        java.lang.RuntimeException - wrapping an InterruptedException if the current thread is interrupted
      • blockingAwait

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final boolean blockingAwait(long timeout,
                                                                   java.util.concurrent.TimeUnit 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.
        Scheduler:
        blockingAwait does not operate by default on a particular Scheduler.
        Parameters:
        timeout - the timeout value
        unit - the timeout unit
        Returns:
        true if the this Completable instance completed normally within the time limit, false if the timeout elapsed before this Completable terminated.
        Throws:
        java.lang.RuntimeException - wrapping an InterruptedException if the current thread is interrupted
      • blockingGet

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final java.lang.Throwable blockingGet()
        Subscribes to this Completable instance and blocks until it terminates, then returns null or the emitted exception if any.
        Scheduler:
        blockingGet does not operate by default on a particular Scheduler.
        Returns:
        the throwable if this terminated with an error, null otherwise
        Throws:
        java.lang.RuntimeException - that wraps an InterruptedException if the wait is interrupted
      • blockingGet

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final java.lang.Throwable blockingGet(long timeout,
                                                                             java.util.concurrent.TimeUnit 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.
        Scheduler:
        blockingGet does not operate by default on a particular Scheduler.
        Parameters:
        timeout - the timeout value
        unit - the time unit
        Returns:
        the throwable if this terminated with an error, null otherwise
        Throws:
        java.lang.RuntimeException - that wraps an InterruptedException if the wait is interrupted or TimeoutException if the specified timeout elapsed before it
      • cache

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable 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.

        Note that this operator doesn't allow disposing the connection of the upstream source.

        Scheduler:
        cache does not operate by default on a particular Scheduler.
        Returns:
        the new Completable instance
        Since:
        2.0.4 - experimental
      • compose

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable compose(CompletableTransformer transformer)
        Calls the given transformer function with this instance and returns the function's resulting Completable.
        Scheduler:
        compose does not operate by default on a particular Scheduler.
        Parameters:
        transformer - the transformer function, not null
        Returns:
        the Completable returned by the function
        Throws:
        java.lang.NullPointerException - if transformer is null
      • concatWith

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable concatWith(CompletableSource other)
        Concatenates this Completable with another Completable.
        Scheduler:
        concatWith does not operate by default on a particular Scheduler.
        Parameters:
        other - the other Completable, not null
        Returns:
        the new Completable which subscribes to this and then the other Completable
        Throws:
        java.lang.NullPointerException - if other is null
      • delay

        @CheckReturnValue
        @SchedulerSupport(value="io.reactivex:computation")
        public final Completable delay(long delay,
                                                               java.util.concurrent.TimeUnit unit)
        Returns a Completable which delays the emission of the completion event by the given time.
        Scheduler:
        delay does operate by default on the computation Scheduler.
        Parameters:
        delay - the delay time
        unit - the delay unit
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if unit is null
      • delay

        @CheckReturnValue
        @SchedulerSupport(value="custom")
        public final Completable delay(long delay,
                                                               java.util.concurrent.TimeUnit unit,
                                                               Scheduler scheduler)
        Returns a Completable which delays the emission of the completion event by the given time while running on the specified scheduler.
        Scheduler:
        delay operates on the Scheduler you specify.
        Parameters:
        delay - the delay time
        unit - the delay unit
        scheduler - the scheduler to run the delayed completion on
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if unit or scheduler is null
      • delay

        @CheckReturnValue
        @SchedulerSupport(value="custom")
        public final Completable delay(long delay,
                                                               java.util.concurrent.TimeUnit unit,
                                                               Scheduler scheduler,
                                                               boolean 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.
        Scheduler:
        delay operates on the Scheduler you specify.
        Parameters:
        delay - the delay time
        unit - the delay unit
        scheduler - the scheduler to run the delayed completion on
        delayError - delay the error emission as well?
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if unit or scheduler is null
      • doOnComplete

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable doOnComplete(Action onComplete)
        Returns a Completable which calls the given onComplete callback if this Completable completes.
        Scheduler:
        doOnComplete does not operate by default on a particular Scheduler.
        Parameters:
        onComplete - the callback to call when this emits an onComplete event
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if onComplete is null
      • doOnDispose

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable doOnDispose(Action onDispose)
        Returns a Completable which calls the given onDispose callback if the child subscriber cancels the subscription.
        Scheduler:
        doOnDispose does not operate by default on a particular Scheduler.
        Parameters:
        onDispose - the callback to call when the child subscriber disposes the subscription
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if onDispose is null
      • doOnError

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable doOnError(Consumer<? super java.lang.Throwable> onError)
        Returns a Completable which calls the given onError callback if this Completable emits an error.
        Scheduler:
        doOnError does not operate by default on a particular Scheduler.
        Parameters:
        onError - the error callback
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if onError is null
      • doOnEvent

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable doOnEvent(Consumer<? super java.lang.Throwable> 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.
        Scheduler:
        doOnEvent does not operate by default on a particular Scheduler.
        Parameters:
        onEvent - the event callback
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if onEvent is null
      • doOnSubscribe

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable doOnSubscribe(Consumer<? super Disposable> onSubscribe)
        Returns a Completable instance that calls the given onSubscribe callback with the disposable that child subscribers receive on subscription.
        Scheduler:
        doOnSubscribe does not operate by default on a particular Scheduler.
        Parameters:
        onSubscribe - the callback called when a child subscriber subscribes
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if onSubscribe is null
      • doOnTerminate

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable doOnTerminate(Action onTerminate)
        Returns a Completable instance that calls the given onTerminate callback just before this Completable completes normally or with an exception
        Scheduler:
        doOnTerminate does not operate by default on a particular Scheduler.
        Parameters:
        onTerminate - the callback to call just before this Completable terminates
        Returns:
        the new Completable instance
      • doAfterTerminate

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable doAfterTerminate(Action onAfterTerminate)
        Returns a Completable instance that calls the given onTerminate callback after this Completable completes normally or with an exception
        Scheduler:
        doAfterTerminate does not operate by default on a particular Scheduler.
        Parameters:
        onAfterTerminate - the callback to call after this Completable terminates
        Returns:
        the new Completable instance
      • doFinally

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable doFinally(Action onFinally)
        Calls the specified action after this Completable signals onError or onComplete or gets disposed by the downstream.

        In case of a race between a terminal event and a dispose call, the provided onFinally action is executed once per subscription.

        Note that the onFinally action is shared between subscriptions and as such should be thread-safe.

        Scheduler:
        doFinally does not operate by default on a particular Scheduler.
        Parameters:
        onFinally - the action called when this Completable terminates or gets cancelled
        Returns:
        the new Completable instance
        Since:
        2.0.1 - experimental
      • lift

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable lift(CompletableOperator onLift)
        Advanced use without safeguards: lifts a CompletableOperator transformation into the chain of Completables.
        Scheduler:
        lift does not operate by default on a particular Scheduler.
        Parameters:
        onLift - the lifting function that transforms the child subscriber with a parent subscriber.
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if onLift is null
      • mergeWith

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable mergeWith(CompletableSource other)
        Returns a Completable which subscribes to this and the other Completable and completes when both of them complete or one emits an error.
        Scheduler:
        mergeWith does not operate by default on a particular Scheduler.
        Parameters:
        other - the other Completable instance
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if other is null
      • observeOn

        @CheckReturnValue
        @SchedulerSupport(value="custom")
        public final Completable observeOn(Scheduler scheduler)
        Returns a Completable which emits the terminal events from the thread of the specified scheduler.
        Scheduler:
        observeOn operates on a Scheduler you specify.
        Parameters:
        scheduler - the scheduler to emit terminal events on
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if scheduler is null
      • onErrorComplete

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable onErrorComplete()
        Returns a Completable instance that if this Completable emits an error, it will emit an onComplete and swallow the throwable.
        Scheduler:
        onErrorComplete does not operate by default on a particular Scheduler.
        Returns:
        the new Completable instance
      • onErrorComplete

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable onErrorComplete(Predicate<? super java.lang.Throwable> 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.
        Scheduler:
        onErrorComplete does not operate by default on a particular Scheduler.
        Parameters:
        predicate - the predicate to call when an Throwable is emitted which should return true if the Throwable should be swallowed and replaced with an onComplete.
        Returns:
        the new Completable instance
      • onErrorResumeNext

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable onErrorResumeNext(Function<? super java.lang.Throwable,? extends CompletableSource> 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.
        Scheduler:
        onErrorResumeNext does not operate by default on a particular Scheduler.
        Parameters:
        errorMapper - the mapper function that takes the error and should return a Completable as continuation.
        Returns:
        the new Completable instance
      • repeat

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable repeat(long times)
        Returns a Completable that subscribes repeatedly at most the given times to this Completable.
        Scheduler:
        repeat does not operate by default on a particular Scheduler.
        Parameters:
        times - the number of times the resubscription should happen
        Returns:
        the new Completable instance
        Throws:
        java.lang.IllegalArgumentException - if times is less than zero
      • repeatUntil

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable repeatUntil(BooleanSupplier stop)
        Returns a Completable that repeatedly subscribes to this Completable so long as the given stop supplier returns false.
        Scheduler:
        repeatUntil does not operate by default on a particular Scheduler.
        Parameters:
        stop - the supplier that should return true to stop resubscribing.
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if stop is null
      • repeatWhen

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable repeatWhen(Function<? super Flowable<java.lang.Object>,? extends org.reactivestreams.Publisher<?>> 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.
        Scheduler:
        repeatWhen does not operate by default on a particular Scheduler.
        Parameters:
        handler - 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
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if stop is null
      • retry

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable retry(BiPredicate<? super java.lang.Integer,? super java.lang.Throwable> predicate)
        Returns a Completable that retries this Completable in case of an error as long as the predicate returns true.
        Scheduler:
        retry does not operate by default on a particular Scheduler.
        Parameters:
        predicate - the predicate called when this emits an error with the repeat count and the latest exception and should return true to retry.
        Returns:
        the new Completable instance
      • retry

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable retry(long 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.
        Scheduler:
        retry does not operate by default on a particular Scheduler.
        Parameters:
        times - the number of times the returned Completable should retry this Completable
        Returns:
        the new Completable instance
        Throws:
        java.lang.IllegalArgumentException - if times is negative
      • retry

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable retry(Predicate<? super java.lang.Throwable> 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.
        Scheduler:
        retry does not operate by default on a particular Scheduler.
        Parameters:
        predicate - the predicate that is called with the latest throwable and should return true to indicate the returned Completable should resubscribe to this Completable.
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if predicate is null
      • retryWhen

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable retryWhen(Function<? super Flowable<java.lang.Throwable>,? extends org.reactivestreams.Publisher<?>> 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.
        Scheduler:
        retryWhen does not operate by default on a particular Scheduler.
        Parameters:
        handler - 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.
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if handler is null
      • startWith

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable startWith(CompletableSource other)
        Returns a Completable which first runs the other Completable then this completable if the other completed normally.
        Scheduler:
        startWith does not operate by default on a particular Scheduler.
        Parameters:
        other - the other completable to run first
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if other is null
      • startWith

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final <T> Observable<T> startWith(Observable<T> other)
        Returns an Observable which first delivers the events of the other Observable then runs this CompletableConsumable.
        Scheduler:
        startWith does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the value type
        Parameters:
        other - the other Observable to run first
        Returns:
        the new Observable instance
        Throws:
        java.lang.NullPointerException - if other is null
      • startWith

        @CheckReturnValue
        @BackpressureSupport(value=FULL)
        @SchedulerSupport(value="none")
        public final <T> Flowable<T> startWith(org.reactivestreams.Publisher<T> other)
        Returns a Flowable which first delivers the events of the other Publisher then runs this Completable.
        Backpressure:
        The returned Flowable honors the backpressure of the downstream consumer and expects the other Publisher to honor it as well.
        Scheduler:
        startWith does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the value type
        Parameters:
        other - the other Publisher to run first
        Returns:
        the new Flowable instance
        Throws:
        java.lang.NullPointerException - if other is null
      • hide

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Completable hide()
        Hides the identity of this Completable and its Disposable.

        Allows preventing certain identity-based optimizations (fusion).

        Scheduler:
        hide does not operate by default on a particular Scheduler.
        Returns:
        the new Completable instance
        Since:
        2.0.5 - experimental
      • subscribe

        @SchedulerSupport(value="none")
        public final Disposable subscribe()
        Subscribes to this CompletableConsumable and returns a Disposable which can be used to cancel the subscription.
        Scheduler:
        subscribe does not operate by default on a particular Scheduler.
        Returns:
        the Disposable that allows cancelling the subscription
      • subscribeActual

        protected abstract void subscribeActual(CompletableObserver s)
        Implement this to handle the incoming CompletableObserver and perform the business logic in your operator.
        Parameters:
        s - the CompletableObserver instance, never null
      • subscribeWith

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final <E extends CompletableObserver> E subscribeWith(E observer)
        Subscribes a given CompletableObserver (subclass) to this Completable and returns the given CompletableObserver as is.

        Usage example:

        
         Completable source = Completable.complete().delay(1, TimeUnit.SECONDS);
         CompositeDisposable composite = new CompositeDisposable();
        
         class ResourceCompletableObserver implements CompletableObserver, Disposable {
             // ...
         }
        
         composite.add(source.subscribeWith(new ResourceCompletableObserver()));
         
        Scheduler:
        subscribeWith does not operate by default on a particular Scheduler.
        Type Parameters:
        E - the type of the CompletableObserver to use and return
        Parameters:
        observer - the CompletableObserver (subclass) to use and return, not null
        Returns:
        the input observer
        Throws:
        java.lang.NullPointerException - if observer is null
        Since:
        2.0
      • subscribe

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Disposable subscribe(Action onComplete,
                                                                  Consumer<? super java.lang.Throwable> onError)
        Subscribes to this Completable and calls back either the onError or onComplete functions.
        Scheduler:
        subscribe does not operate by default on a particular Scheduler.
        Parameters:
        onComplete - the runnable that is called if the Completable completes normally
        onError - the consumer that is called if this Completable emits an error
        Returns:
        the Disposable that can be used for cancelling the subscription asynchronously
        Throws:
        java.lang.NullPointerException - if either callback is null
      • subscribe

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final Disposable subscribe(Action onComplete)
        Subscribes to this Completable and calls the given Action when this Completable completes normally.

        If the Completable emits an error, it is wrapped into an OnErrorNotImplementedException and routed to the RxJavaPlugins.onError handler.

        Scheduler:
        subscribe does not operate by default on a particular Scheduler.
        Parameters:
        onComplete - the runnable called when this Completable completes normally
        Returns:
        the Disposable that allows cancelling the subscription
      • subscribeOn

        @CheckReturnValue
        @SchedulerSupport(value="custom")
        public final Completable subscribeOn(Scheduler 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.
        Scheduler:
        subscribeOn operates on a Scheduler you specify.
        Parameters:
        scheduler - the Scheduler to subscribe on
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if scheduler is null
      • timeout

        @CheckReturnValue
        @SchedulerSupport(value="io.reactivex:computation")
        public final Completable timeout(long timeout,
                                                                 java.util.concurrent.TimeUnit unit)
        Returns a Completable that runs this Completable and emits a TimeoutException in case this Completable doesn't complete within the given time.
        Scheduler:
        timeout signals the TimeoutException on the computation Scheduler.
        Parameters:
        timeout - the timeout value
        unit - the timeout unit
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if unit is null
      • timeout

        @CheckReturnValue
        @SchedulerSupport(value="io.reactivex:computation")
        public final Completable timeout(long timeout,
                                                                 java.util.concurrent.TimeUnit unit,
                                                                 CompletableSource 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.
        Scheduler:
        timeout subscribes to the other CompletableSource on the computation Scheduler.
        Parameters:
        timeout - the timeout value
        unit - the timeout unit
        other - the other Completable instance to switch to in case of a timeout
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if unit or other is null
      • timeout

        @CheckReturnValue
        @SchedulerSupport(value="custom")
        public final Completable timeout(long timeout,
                                                                 java.util.concurrent.TimeUnit unit,
                                                                 Scheduler 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.
        Scheduler:
        timeout signals the TimeoutException on the Scheduler you specify.
        Parameters:
        timeout - the timeout value
        unit - the timeout unit
        scheduler - the scheduler to use to wait for completion
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if unit or scheduler is null
      • timeout

        @CheckReturnValue
        @SchedulerSupport(value="custom")
        public final Completable timeout(long timeout,
                                                                 java.util.concurrent.TimeUnit unit,
                                                                 Scheduler scheduler,
                                                                 CompletableSource 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.
        Scheduler:
        timeout subscribes to the other CompletableSource on the Scheduler you specify.
        Parameters:
        timeout - the timeout value
        unit - the timeout unit
        scheduler - the scheduler to use to wait for completion
        other - the other Completable instance to switch to in case of a timeout
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if unit, scheduler or other is null
      • to

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final <U> U to(Function<? super Completable,U> converter)
        Allows fluent conversion to another type via a function callback.
        Scheduler:
        to does not operate by default on a particular Scheduler.
        Type Parameters:
        U - the output type
        Parameters:
        converter - the function called with this which should return some other value.
        Returns:
        the converted value
        Throws:
        java.lang.NullPointerException - if converter is null
      • toFlowable

        @CheckReturnValue
        @BackpressureSupport(value=FULL)
        @SchedulerSupport(value="none")
        public final <T> Flowable<T> toFlowable()
        Returns a Flowable which when subscribed to subscribes to this Completable and relays the terminal events to the subscriber.
        Backpressure:
        The returned Flowable honors the backpressure of the downstream consumer.
        Scheduler:
        toFlowable does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the value type
        Returns:
        the new Flowable instance
      • toObservable

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final <T> Observable<T> toObservable()
        Returns an Observable which when subscribed to subscribes to this Completable and relays the terminal events to the subscriber.
        Scheduler:
        toObservable does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the value type
        Returns:
        the new Observable created
      • toSingle

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final <T> Single<T> toSingle(java.util.concurrent.Callable<? extends T> completionValueSupplier)
        Converts this Completable into a Single which when this Completable completes normally, calls the given supplier and emits its returned value through onSuccess.
        Scheduler:
        toSingle does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the value type
        Parameters:
        completionValueSupplier - the value supplier called when this Completable completes normally
        Returns:
        the new Single instance
        Throws:
        java.lang.NullPointerException - if completionValueSupplier is null
      • toSingleDefault

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final <T> Single<T> toSingleDefault(T completionValue)
        Converts this Completable into a Single which when this Completable completes normally, emits the given value through onSuccess.
        Scheduler:
        toSingleDefault does not operate by default on a particular Scheduler.
        Type Parameters:
        T - the value type
        Parameters:
        completionValue - the value to emit when this Completable completes normally
        Returns:
        the new Single instance
        Throws:
        java.lang.NullPointerException - if completionValue is null
      • unsubscribeOn

        @CheckReturnValue
        @SchedulerSupport(value="custom")
        public final Completable unsubscribeOn(Scheduler scheduler)
        Returns a Completable which makes sure when a subscriber cancels the subscription, the dispose is called on the specified scheduler
        Scheduler:
        unsubscribeOn calls dispose() of the upstream on the Scheduler you specify.
        Parameters:
        scheduler - the target scheduler where to execute the cancellation
        Returns:
        the new Completable instance
        Throws:
        java.lang.NullPointerException - if scheduler is null
      • test

        @CheckReturnValue
        @SchedulerSupport(value="none")
        public final TestObserver<java.lang.Void> test(boolean cancelled)
        Creates a TestObserver optionally in cancelled state, then subscribes it to this Completable.
        Parameters:
        cancelled - if true, the TestObserver will be cancelled before subscribing to this Completable.
        Scheduler:
        test does not operate by default on a particular Scheduler.
        Returns:
        the new TestObserver instance
        Since:
        2.0