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) SerialSubscription
connection
Holds onto the subscriber connected to source.(package private) static CachedObservable.ReplayProducer<?>[]
EMPTY
The default empty array of producers.(package private) boolean
isConnected
Set to true after connection.(package private) NotificationLite<T>
nl
(package private) CachedObservable.ReplayProducer<?>[]
producers
Guarded by connection (not this).(package private) Observable<? extends T>
source
The source observable to connect to.(package private) boolean
sourceDone
Indicates 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 void
addProducer(CachedObservable.ReplayProducer<T> p)
Adds a ReplayProducer to the producers array atomically.void
connect()
Connects the cache to the source.(package private) void
dispatch()
Signals all known children there is work to do.void
onCompleted()
Notifies the Observer that theObservable
has finished sending push-based notifications.void
onError(java.lang.Throwable e)
Notifies the Observer that theObservable
has experienced an error condition.void
onNext(T t)
Provides the Observer with a new item to observe.void
removeProducer(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:Observer
Provides the Observer with a new item to observe.The
Observable
may call this method 0 or more times.The
Observable
will 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:Observer
Notifies the Observer that theObservable
has experienced an error condition.If the
Observable
calls this method, it will not thereafter callObserver.onNext(T)
orObserver.onCompleted()
.
-
onCompleted
public void onCompleted()
Description copied from interface:Observer
Notifies the Observer that theObservable
has finished sending push-based notifications.The
Observable
will not call this method if it callsObserver.onError(java.lang.Throwable)
.- Specified by:
onCompleted
in interfaceObserver<T>
-
dispatch
void dispatch()
Signals all known children there is work to do.
-
-