Class CompletableCache
- java.lang.Object
-
- io.reactivex.rxjava3.core.Completable
-
- io.reactivex.rxjava3.internal.operators.completable.CompletableCache
-
- All Implemented Interfaces:
CompletableObserver
,CompletableSource
public final class CompletableCache extends Completable implements CompletableObserver
Consume the upstream source exactly once and cache its terminal event.History: 2.0.4 - experimental
- Since:
- 2.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
CompletableCache.InnerCompletableCache
-
Field Summary
Fields Modifier and Type Field Description (package private) static CompletableCache.InnerCompletableCache[]
EMPTY
(package private) java.lang.Throwable
error
(package private) java.util.concurrent.atomic.AtomicReference<CompletableCache.InnerCompletableCache[]>
observers
(package private) java.util.concurrent.atomic.AtomicBoolean
once
(package private) CompletableSource
source
(package private) static CompletableCache.InnerCompletableCache[]
TERMINATED
-
Constructor Summary
Constructors Constructor Description CompletableCache(CompletableSource source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) boolean
add(CompletableCache.InnerCompletableCache inner)
void
onComplete()
Called once the deferred computation completes normally.void
onError(java.lang.Throwable e)
Called once if the deferred computation 'throws' an exception.void
onSubscribe(Disposable d)
Called once by theCompletable
to set aDisposable
on this instance which then can be used to cancel the subscription at any time.(package private) void
remove(CompletableCache.InnerCompletableCache inner)
protected void
subscribeActual(CompletableObserver observer)
Implement this method to handle the incomingCompletableObserver
s and perform the business logic in your operator.-
Methods inherited from class io.reactivex.rxjava3.core.Completable
amb, ambArray, ambWith, andThen, andThen, andThen, andThen, andThen, blockingAwait, blockingAwait, blockingSubscribe, blockingSubscribe, blockingSubscribe, blockingSubscribe, cache, complete, compose, concat, concat, concat, concatArray, concatArrayDelayError, concatDelayError, concatDelayError, concatDelayError, concatWith, create, defer, delay, delay, delay, delaySubscription, delaySubscription, doAfterTerminate, doFinally, doOnComplete, doOnDispose, doOnError, doOnEvent, doOnLifecycle, doOnSubscribe, doOnTerminate, error, error, fromAction, fromCallable, fromCompletionStage, fromFuture, fromMaybe, fromObservable, fromPublisher, fromRunnable, fromSingle, fromSupplier, hide, lift, materialize, merge, merge, merge, mergeArray, mergeArrayDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeWith, never, observeOn, onErrorComplete, onErrorComplete, onErrorResumeNext, onErrorResumeWith, onErrorReturn, onErrorReturnItem, onTerminateDetach, repeat, repeat, repeatUntil, repeatWhen, retry, retry, retry, retry, retry, retryUntil, retryWhen, safeSubscribe, sequenceEqual, startWith, startWith, startWith, startWith, startWith, subscribe, subscribe, subscribe, subscribe, subscribe, subscribeOn, subscribeWith, switchOnNext, switchOnNextDelayError, takeUntil, test, test, timeout, timeout, timeout, timeout, timer, timer, to, toCompletionStage, toFlowable, toFuture, toMaybe, toObservable, toSingle, toSingleDefault, unsafeCreate, unsubscribeOn, using, using, wrap
-
-
-
-
Field Detail
-
EMPTY
static final CompletableCache.InnerCompletableCache[] EMPTY
-
TERMINATED
static final CompletableCache.InnerCompletableCache[] TERMINATED
-
source
final CompletableSource source
-
observers
final java.util.concurrent.atomic.AtomicReference<CompletableCache.InnerCompletableCache[]> observers
-
once
final java.util.concurrent.atomic.AtomicBoolean once
-
error
java.lang.Throwable error
-
-
Constructor Detail
-
CompletableCache
public CompletableCache(CompletableSource source)
-
-
Method Detail
-
subscribeActual
protected void subscribeActual(CompletableObserver observer)
Description copied from class:Completable
Implement this method to handle the incomingCompletableObserver
s and perform the business logic in your operator.There is no need to call any of the plugin hooks on the current
Completable
instance or theCompletableObserver
; all hooks and basic safeguards have been applied byCompletable.subscribe(CompletableObserver)
before this method gets called.- Specified by:
subscribeActual
in classCompletable
- Parameters:
observer
- theCompletableObserver
instance, nevernull
-
onSubscribe
public void onSubscribe(Disposable d)
Description copied from interface:CompletableObserver
Called once by theCompletable
to set aDisposable
on this instance which then can be used to cancel the subscription at any time.- Specified by:
onSubscribe
in interfaceCompletableObserver
- Parameters:
d
- theDisposable
instance to call dispose on for cancellation, not null
-
onError
public void onError(java.lang.Throwable e)
Description copied from interface:CompletableObserver
Called once if the deferred computation 'throws' an exception.- Specified by:
onError
in interfaceCompletableObserver
- Parameters:
e
- the exception, notnull
.
-
onComplete
public void onComplete()
Description copied from interface:CompletableObserver
Called once the deferred computation completes normally.- Specified by:
onComplete
in interfaceCompletableObserver
-
add
boolean add(CompletableCache.InnerCompletableCache inner)
-
remove
void remove(CompletableCache.InnerCompletableCache inner)
-
-