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>
Contains the active child producers and the values to replay.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final SerialSubscription
Holds onto the subscriber connected to source.(package private) static final CachedObservable.ReplayProducer<?>[]
The default empty array of producers.(package private) boolean
Set to true after connection.(package private) final NotificationLite
<T> (package private) CachedObservable.ReplayProducer<?>[]
Guarded by connection (not this).(package private) final Observable
<? extends T> The source observable to connect to.(package private) boolean
Indicates that the source has completed emitting values or the Observable was forcefully terminated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Notifies the Observer that theObservable
has finished sending push-based notifications.void
Notifies the Observer that theObservable
has experienced an error condition.void
Provides the Observer with a new item to observe.void
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 Details
-
source
The source observable to connect to. -
connection
Holds onto the subscriber connected to source. -
producers
Guarded by connection (not this). -
EMPTY
The default empty array of producers. -
nl
-
isConnected
volatile boolean isConnectedSet to true after connection. -
sourceDone
boolean sourceDoneIndicates that the source has completed emitting values or the Observable was forcefully terminated.
-
-
Constructor Details
-
CacheState
-
-
Method Details
-
addProducer
Adds a ReplayProducer to the producers array atomically.- Parameters:
p
-
-
removeProducer
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
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
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.
-