| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | CachedObservable.CachedSubscribe<
the value type emitted T>Manages the subscription of child subscribers by setting up a replay producer and performs auto-connection of the very first subscription. |
| pack-priv static class | |
| pack-priv static class | CachedObservable.ReplayProducer<T>
Keeps track of the current request amount and the replay position for a child Subscriber. |
| Modifier and Type | Field and Description |
|---|---|
| private final CachedObservable. | state
The cache and replay state. |
| Access | Constructor and Description |
|---|---|
| private | CachedObservable(Observable.
the shared OnSubscribe implementation onSubscribe,the cache state object statePrivate constructor because state needs to be shared between the Observable body and the onSubscribe function. |
| Modifier and Type | Method and Description |
|---|---|
| public static < the value type T> CachedObservable | Returns: the CachedObservable instancethe source Observable to cache source)Creates a cached Observable with a default capacity hint of 16. |
| public static < the value type T> CachedObservable | Returns: the CachedObservable instancethe source Observable to cache source, int the hint for the internal buffer size capacityHint)Creates a cached Observable with the given capacity hint. |
| pack-priv boolean | Returns: true if this CachedObservable has observersReturns true if there are observers subscribed to this observable. |
| pack-priv boolean | Returns: true if already connectedCheck if this cached observable is connected to its source. |
| state | back to summary |
|---|---|
| private final CachedObservable. The cache and replay state. | |
| CachedObservable | back to summary |
|---|---|
| private CachedObservable(Observable. Private constructor because state needs to be shared between the Observable body and the onSubscribe function.
| |
| from | back to summary |
|---|---|
| public static <T> CachedObservable Creates a cached Observable with a default capacity hint of 16.
| |
| from | back to summary |
|---|---|
| public static <T> CachedObservable Creates a cached Observable with the given capacity hint.
| |
| hasObservers | back to summary |
|---|---|
| pack-priv boolean hasObservers() Returns true if there are observers subscribed to this observable.
| |
| isConnected | back to summary |
|---|---|
| pack-priv boolean isConnected() Check if this cached observable is connected to its source.
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final long | |
| pack-priv final CachedObservable. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. | |
| state | back to summary |
|---|---|
| pack-priv final CachedObservable. | |
| CachedSubscribe | back to summary |
|---|---|
| public CachedSubscribe(CachedObservable. | |
| call | back to summary |
|---|---|
| public void call(Subscriber<? super T> t) Implements rx.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final SerialSubscription | connection
Holds onto the subscriber connected to source. |
| pack-priv static final CachedObservable. | EMPTY
The default empty array of producers. |
| pack-priv volatile boolean | isConnected
Set to true after connection. |
| pack-priv volatile CachedObservable. | producers
Guarded by connection (not this). |
| pack-priv final Observable | source
The source observable to connect to. |
| pack-priv boolean | sourceDone
Indicates that the source has completed emitting values or the Observable was forcefully terminated. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addProducer(CachedObservable.
the downstream consumer's associated Producer instance pAdds a ReplayProducer to the producers array atomically. |
| public void | |
| pack-priv void | |
| public void | onCompleted()
Implements rx. Observable has finished sending push-based notifications.
|
| public void | onError(Throwable
the exception encountered by the Observable e)Implements rx. Observable has experienced an error condition.
|
| public void | onNext(T
the item emitted by the Observable t)Implements rx. |
| public void | removeProducer(CachedObservable.
the downstream consumer's associated Producer instance pRemoves the ReplayProducer (if present) from the producers array atomically. |
| connection | back to summary |
|---|---|
| pack-priv final SerialSubscription connection Holds onto the subscriber connected to source. | |
| EMPTY | back to summary |
|---|---|
| pack-priv static final CachedObservable. The default empty array of producers. | |
| isConnected | back to summary |
|---|---|
| pack-priv volatile boolean isConnected Set to true after connection. | |
| producers | back to summary |
|---|---|
| pack-priv volatile CachedObservable. Guarded by connection (not this). | |
| source | back to summary |
|---|---|
| pack-priv final Observable<? extends T> source The source observable to connect to. | |
| sourceDone | back to summary |
|---|---|
| pack-priv boolean sourceDone Indicates that the source has completed emitting values or the Observable was forcefully terminated. | |
| CacheState | back to summary |
|---|---|
| public CacheState(Observable<? extends T> source, int capacityHint) | |
| addProducer | back to summary |
|---|---|
| public void addProducer(CachedObservable. Adds a ReplayProducer to the producers array atomically.
| |
| connect | back to summary |
|---|---|
| public void connect() Connects the cache to the source. Make sure this is called only once. | |
| dispatch | back to summary |
|---|---|
| pack-priv void dispatch() Signals all known children there is work to do. | |
| onCompleted | back to summary |
|---|---|
| public void onCompleted() Implements rx. Doc from rx. Notifies the Observer that the
The
| |
| onError | back to summary |
|---|---|
| public void onError(Throwable e) Implements rx. Doc from rx. Notifies the Observer that the
If the | |
| onNext | back to summary |
|---|---|
| public void onNext(T t) Implements rx. Doc from rx. Provides the Observer with a new item to observe.
The
The
| |
| removeProducer | back to summary |
|---|---|
| public void removeProducer(CachedObservable. Removes the ReplayProducer (if present) from the producers array atomically.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final Subscriber | child
The actual child subscriber. |
| pack-priv Object[] | currentBuffer
Contains the reference to the buffer segment in replay. |
| pack-priv int | currentIndexInBuffer
Contains the index into the currentBuffer where the next value is expected. |
| pack-priv boolean | emitting
Indicates there is a replay going on; guarded by this. |
| pack-priv int | index
Contains the absolute index up until the values have been replayed so far. |
| pack-priv boolean | missed
Indicates there were some state changes/replay attempts; guarded by this. |
| private static final long | |
| pack-priv final CachedObservable. | state
The cache state object. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | isUnsubscribed()
Implements rx. Subscription is currently unsubscribed.
|
| public long | Returns: the latest request amount after subtracting nthe produced item count, positive, not validated n)Updates the request count to reflect values have been produced. |
| public void | |
| public void | request(long
the maximum number of items you want this Producer to produce, or n)Long.MAX_VALUE if you
want the Producer to produce items at its own paceImplements rx. |
| public void | unsubscribe()
Implements rx. Subscriber that was registered when this Subscription
was received.
|
| child | back to summary |
|---|---|
| pack-priv final Subscriber<? super T> child The actual child subscriber. | |
| currentBuffer | back to summary |
|---|---|
| pack-priv Object[] currentBuffer Contains the reference to the buffer segment in replay. Accessed after reading state.size() and when emitting == true. | |
| currentIndexInBuffer | back to summary |
|---|---|
| pack-priv int currentIndexInBuffer Contains the index into the currentBuffer where the next value is expected. Accessed after reading state.size() and when emitting == true. | |
| emitting | back to summary |
|---|---|
| pack-priv boolean emitting Indicates there is a replay going on; guarded by this. | |
| index | back to summary |
|---|---|
| pack-priv int index Contains the absolute index up until the values have been replayed so far. | |
| missed | back to summary |
|---|---|
| pack-priv boolean missed Indicates there were some state changes/replay attempts; guarded by this. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. | |
| state | back to summary |
|---|---|
| pack-priv final CachedObservable. The cache state object. | |
| ReplayProducer | back to summary |
|---|---|
| public ReplayProducer(Subscriber<? super T> child, CachedObservable. | |
| isUnsubscribed | back to summary |
|---|---|
| public boolean isUnsubscribed() Implements rx. Doc from rx. Indicates whether this
| |
| produced | back to summary |
|---|---|
| public long produced(long n) Updates the request count to reflect values have been produced.
| |
| replay | back to summary |
|---|---|
| public void replay() Continue replaying available values if there are requests for them. | |
| request | back to summary |
|---|---|
| public void request(long n) Implements rx. Doc from rx. Request a certain maximum number of items from this Producer. This is a way of requesting backpressure.
To disable backpressure, pass
Requests are additive but if a sequence of requests totals more than request(100); request(Long.MAX_VALUE-1);
| |
| unsubscribe | back to summary |
|---|---|
| public void unsubscribe() Implements rx. Doc from rx. Stops the receipt of notifications on the
This allows deregistering an
| |