Package rx.internal.operators
Class CachedObservable.CacheState<T>
- java.lang.Object
-
- rx.internal.util.LinkedArrayList
-
- rx.internal.operators.CachedObservable.CacheState<T>
-
- Type Parameters:
T-
- All Implemented Interfaces:
Observer<T>
- Enclosing class:
- CachedObservable<T>
static final class CachedObservable.CacheState<T> extends LinkedArrayList implements Observer<T>
Contains the active child producers and the values to replay.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) SerialSubscriptionconnectionHolds onto the subscriber connected to source.(package private) static CachedObservable.ReplayProducer<?>[]EMPTYThe default empty array of producers.(package private) booleanisConnectedSet to true after connection.(package private) NotificationLite<T>nl(package private) CachedObservable.ReplayProducer<?>[]producersGuarded by connection (not this).(package private) Observable<? extends T>sourceThe source observable to connect to.(package private) booleansourceDoneIndicates that the source has completed emitting values or the Observable was forcefully terminated.
-
Constructor Summary
Constructors Constructor Description CacheState(Observable<? extends T> source, int capacityHint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProducer(CachedObservable.ReplayProducer<T> p)Adds a ReplayProducer to the producers array atomically.voidconnect()Connects the cache to the source.(package private) voiddispatch()Signals all known children there is work to do.voidonCompleted()Notifies the Observer that theObservablehas finished sending push-based notifications.voidonError(java.lang.Throwable e)Notifies the Observer that theObservablehas experienced an error condition.voidonNext(T t)Provides the Observer with a new item to observe.voidremoveProducer(CachedObservable.ReplayProducer<T> p)Removes the ReplayProducer (if present) from the producers array atomically.-
Methods inherited from class rx.internal.util.LinkedArrayList
add, capacityHint, head, indexInTail, size, tail, toString
-
-
-
-
Field Detail
-
source
final Observable<? extends T> source
The source observable to connect to.
-
connection
final SerialSubscription connection
Holds onto the subscriber connected to source.
-
producers
volatile CachedObservable.ReplayProducer<?>[] producers
Guarded by connection (not this).
-
EMPTY
static final CachedObservable.ReplayProducer<?>[] EMPTY
The default empty array of producers.
-
nl
final NotificationLite<T> nl
-
isConnected
volatile boolean isConnected
Set to true after connection.
-
sourceDone
boolean sourceDone
Indicates that the source has completed emitting values or the Observable was forcefully terminated.
-
-
Constructor Detail
-
CacheState
public CacheState(Observable<? extends T> source, int capacityHint)
-
-
Method Detail
-
addProducer
public void addProducer(CachedObservable.ReplayProducer<T> p)
Adds a ReplayProducer to the producers array atomically.- Parameters:
p-
-
removeProducer
public void removeProducer(CachedObservable.ReplayProducer<T> p)
Removes the ReplayProducer (if present) from the producers array atomically.- Parameters:
p-
-
connect
public void connect()
Connects the cache to the source. Make sure this is called only once.
-
onNext
public void onNext(T t)
Description copied from interface:ObserverProvides the Observer with a new item to observe.The
Observablemay call this method 0 or more times.The
Observablewill not call this method again after it calls eitherObserver.onCompleted()orObserver.onError(java.lang.Throwable).
-
onError
public void onError(java.lang.Throwable e)
Description copied from interface:ObserverNotifies the Observer that theObservablehas experienced an error condition.If the
Observablecalls this method, it will not thereafter callObserver.onNext(T)orObserver.onCompleted().
-
onCompleted
public void onCompleted()
Description copied from interface:ObserverNotifies the Observer that theObservablehas finished sending push-based notifications.The
Observablewill not call this method if it callsObserver.onError(java.lang.Throwable).- Specified by:
onCompletedin interfaceObserver<T>
-
dispatch
void dispatch()
Signals all known children there is work to do.
-
-