Class SingleCache<T>
- java.lang.Object
-
- io.reactivex.rxjava3.core.Single<T>
-
- io.reactivex.rxjava3.internal.operators.single.SingleCache<T>
-
- All Implemented Interfaces:
SingleObserver<T>
,SingleSource<T>
public final class SingleCache<T> extends Single<T> implements SingleObserver<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
SingleCache.CacheDisposable<T>
-
Field Summary
Fields Modifier and Type Field Description (package private) static SingleCache.CacheDisposable[]
EMPTY
(package private) java.lang.Throwable
error
(package private) java.util.concurrent.atomic.AtomicReference<SingleCache.CacheDisposable<T>[]>
observers
(package private) SingleSource<? extends T>
source
(package private) static SingleCache.CacheDisposable[]
TERMINATED
(package private) T
value
(package private) java.util.concurrent.atomic.AtomicInteger
wip
-
Constructor Summary
Constructors Constructor Description SingleCache(SingleSource<? extends T> source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) boolean
add(SingleCache.CacheDisposable<T> observer)
void
onError(java.lang.Throwable e)
Notifies theSingleObserver
that theSingle
has experienced an error condition.void
onSubscribe(Disposable d)
Provides theSingleObserver
with the means of cancelling (disposing) the connection (channel) with the Single in both synchronous (from withinonSubscribe(Disposable)
itself) and asynchronous manner.void
onSuccess(T value)
Notifies theSingleObserver
with a single item and that theSingle
has finished sending push-based notifications.(package private) void
remove(SingleCache.CacheDisposable<T> observer)
protected void
subscribeActual(SingleObserver<? super T> observer)
Implement this method in subclasses to handle the incomingSingleObserver
s.-
Methods inherited from class io.reactivex.rxjava3.core.Single
amb, ambArray, ambWith, blockingGet, blockingSubscribe, blockingSubscribe, blockingSubscribe, blockingSubscribe, cache, cast, compose, concat, concat, concat, concat, concat, concat, concat, concatArray, concatArrayDelayError, concatArrayEager, concatArrayEagerDelayError, concatDelayError, concatDelayError, concatDelayError, concatEager, concatEager, concatEager, concatEager, concatEagerDelayError, concatEagerDelayError, concatEagerDelayError, concatEagerDelayError, concatMap, concatMapCompletable, concatMapMaybe, concatWith, contains, contains, create, defer, delay, delay, delay, delay, delaySubscription, delaySubscription, delaySubscription, delaySubscription, delaySubscription, delaySubscription, dematerialize, doAfterSuccess, doAfterTerminate, doFinally, doOnDispose, doOnError, doOnEvent, doOnLifecycle, doOnSubscribe, doOnSuccess, doOnTerminate, error, error, filter, flatMap, flatMap, flatMap, flatMapCompletable, flatMapMaybe, flatMapObservable, flatMapPublisher, flattenAsFlowable, flattenAsObservable, flattenStreamAsFlowable, flattenStreamAsObservable, fromCallable, fromCompletionStage, fromFuture, fromFuture, fromMaybe, fromMaybe, fromObservable, fromPublisher, fromSupplier, hide, ignoreElement, just, lift, map, mapOptional, materialize, merge, merge, merge, merge, merge, merge, mergeArray, mergeArrayDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeWith, never, observeOn, ofType, 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, subscribe, subscribeOn, subscribeWith, switchOnNext, switchOnNextDelayError, takeUntil, takeUntil, takeUntil, test, test, timeInterval, timeInterval, timeInterval, timeInterval, timeout, timeout, timeout, timeout, timer, timer, timestamp, timestamp, timestamp, timestamp, to, toCompletionStage, toFlowable, toFuture, toMaybe, toObservable, unsafeCreate, unsubscribeOn, using, using, wrap, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipArray, zipWith
-
-
-
-
Field Detail
-
EMPTY
static final SingleCache.CacheDisposable[] EMPTY
-
TERMINATED
static final SingleCache.CacheDisposable[] TERMINATED
-
source
final SingleSource<? extends T> source
-
wip
final java.util.concurrent.atomic.AtomicInteger wip
-
observers
final java.util.concurrent.atomic.AtomicReference<SingleCache.CacheDisposable<T>[]> observers
-
value
T value
-
error
java.lang.Throwable error
-
-
Constructor Detail
-
SingleCache
public SingleCache(SingleSource<? extends T> source)
-
-
Method Detail
-
subscribeActual
protected void subscribeActual(SingleObserver<? super T> observer)
Description copied from class:Single
Implement this method in subclasses to handle the incomingSingleObserver
s.There is no need to call any of the plugin hooks on the current
Single
instance or theSingleObserver
; all hooks and basic safeguards have been applied bySingle.subscribe(SingleObserver)
before this method gets called.- Specified by:
subscribeActual
in classSingle<T>
- Parameters:
observer
- theSingleObserver
to handle, notnull
-
add
boolean add(SingleCache.CacheDisposable<T> observer)
-
remove
void remove(SingleCache.CacheDisposable<T> observer)
-
onSubscribe
public void onSubscribe(Disposable d)
Description copied from interface:SingleObserver
Provides theSingleObserver
with the means of cancelling (disposing) the connection (channel) with the Single in both synchronous (from withinonSubscribe(Disposable)
itself) and asynchronous manner.- Specified by:
onSubscribe
in interfaceSingleObserver<T>
- Parameters:
d
- the Disposable instance whoseDisposable.dispose()
can be called anytime to cancel the connection
-
onSuccess
public void onSuccess(T value)
Description copied from interface:SingleObserver
Notifies theSingleObserver
with a single item and that theSingle
has finished sending push-based notifications.The
Single
will not call this method if it callsSingleObserver.onError(java.lang.Throwable)
.- Specified by:
onSuccess
in interfaceSingleObserver<T>
- Parameters:
value
- the item emitted by theSingle
-
onError
public void onError(java.lang.Throwable e)
Description copied from interface:SingleObserver
Notifies theSingleObserver
that theSingle
has experienced an error condition.If the
Single
calls this method, it will not thereafter callSingleObserver.onSuccess(T)
.- Specified by:
onError
in interfaceSingleObserver<T>
- Parameters:
e
- the exception encountered by theSingle
-
-