| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | ObservableCache.CacheDisposable<
the value type T>Hosts the downstream consumer and its current requested and replay states. |
| pack-priv static class | ObservableCache.Node<
the element type T>Represents a segment of the cached item list as part of a linked-node-list structure. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final int | capacityHint
The number of items per cached nodes. |
| pack-priv volatile boolean | done
True if the source has terminated. |
| pack-priv static final ObservableCache. | EMPTY
A shared instance of an empty array of observers to avoid creating a new empty array when all observers dispose. |
| pack-priv Throwable | error
If |
| pack-priv final ObservableCache. | head
The starting point of the cached items. |
| pack-priv final AtomicReference | observers
The current known array of observer state to notify. |
| pack-priv final AtomicBoolean | once
The subscription to the source should happen at most once. |
| pack-priv volatile long | size
The total number of elements in the list available for reads. |
| pack-priv ObservableCache. | tail
The current tail of the linked structure holding the items. |
| pack-priv int | tailOffset
How many items have been put into the tail node so far. |
| pack-priv static final ObservableCache. | TERMINATED
A shared instance indicating the source has no more events and there is no need to remember observers anymore. |
| Access | Constructor and Description |
|---|---|
| public | ObservableCache(Observable<T>
the source to subscribe to for the first incoming observer source, int the number of items expected (reduce allocation frequency) capacityHint)Constructs an empty, non-connected cache. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | add(ObservableCache.
the consumer to add consumerAtomically adds the consumer to the |
| pack-priv long | Returns: the number of currently cached event countReturns the number of events currently cached. |
| pack-priv boolean | Returns: true if the cache 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. |
| public void | onComplete()
Implements io. Observable has finished sending push-based notifications.
|
| public void | onError(Throwable
the exception encountered by the Observable t)Implements io. Observable has experienced an error condition.
|
| public void | onNext(T
the item emitted by the Observable t)Implements io. |
| public void | onSubscribe(Disposable
the Disposable instance whose d)Disposable#dispose() can
be called anytime to cancel the connectionImplements io. onNext(Object)) and asynchronous manner.
|
| pack-priv void | remove(ObservableCache.
the consumer to remove consumerAtomically removes the consumer from the |
| pack-priv void | replay(ObservableCache.
the consumer to continue replaying items to consumerReplays the contents of this cache to the given consumer based on its current state and number of items requested by it. |
| protected void | subscribeActual(Observer<? super T>
the incoming Observer, never null t)Implements abstract io. Observers.
|
| capacityHint | back to summary |
|---|---|
| pack-priv final int capacityHint The number of items per cached nodes. | |
| done | back to summary |
|---|---|
| pack-priv volatile boolean done True if the source has terminated. | |
| EMPTY | back to summary |
|---|---|
| pack-priv static final ObservableCache. A shared instance of an empty array of observers to avoid creating a new empty array when all observers dispose.
| |
| error | back to summary |
|---|---|
| pack-priv Throwable error If | |
| head | back to summary |
|---|---|
| pack-priv final ObservableCache. The starting point of the cached items. | |
| observers | back to summary |
|---|---|
| pack-priv final AtomicReference<ObservableCache. The current known array of observer state to notify. | |
| once | back to summary |
|---|---|
| pack-priv final AtomicBoolean once The subscription to the source should happen at most once. | |
| size | back to summary |
|---|---|
| pack-priv volatile long size The total number of elements in the list available for reads. | |
| tail | back to summary |
|---|---|
| pack-priv ObservableCache. The current tail of the linked structure holding the items. | |
| tailOffset | back to summary |
|---|---|
| pack-priv int tailOffset How many items have been put into the tail node so far. | |
| TERMINATED | back to summary |
|---|---|
| pack-priv static final ObservableCache. A shared instance indicating the source has no more events and there is no need to remember observers anymore.
| |
| ObservableCache | back to summary |
|---|---|
| public ObservableCache(Observable<T> source, int capacityHint) Constructs an empty, non-connected cache.
| |
| add | back to summary |
|---|---|
| pack-priv void add(ObservableCache. Atomically adds the consumer to the
| |
| cachedEventCount | back to summary |
|---|---|
| pack-priv long cachedEventCount() Returns the number of events currently cached.
| |
| 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.
| |
| onComplete | back to summary |
|---|---|
| public void onComplete() Implements io. Doc from io. Notifies the Observer that the
The
| |
| onError | back to summary |
|---|---|
| public void onError(Throwable t) Implements io. Doc from io. Notifies the Observer that the
If the
| |
| onNext | back to summary |
|---|---|
| public void onNext(T t) Implements io. Doc from io. Provides the Observer with a new item to observe.
The
The
| |
| onSubscribe | back to summary |
|---|---|
| public void onSubscribe(Disposable d) Implements io. Doc from io. Provides the Observer with the means of cancelling (disposing) the
connection (channel) with the Observable in both
synchronous (from within
| |
| remove | back to summary |
|---|---|
| pack-priv void remove(ObservableCache. Atomically removes the consumer from the
| |
| replay | back to summary |
|---|---|
| pack-priv void replay(ObservableCache. Replays the contents of this cache to the given consumer based on its current state and number of items requested by it.
| |
| subscribeActual | back to summary |
|---|---|
| protected void subscribeActual(Observer<? super T> t) Implements abstract io. Doc from io. Operator implementations (both source and intermediate) should implement this method that
performs the necessary business logic and handles the incoming There is no need to call any of the plugin hooks on the current | |
this holds the work-in-progress counter for the serialized replay.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv volatile boolean | |
| pack-priv final Observer | |
| pack-priv long | |
| pack-priv ObservableCache. | |
| pack-priv int | |
| pack-priv final ObservableCache | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv | CacheDisposable(Observer<? super T>
the actual consumer downstream, ObservableCache<T> the parent that holds onto the cached items parent)Constructs a new instance with the actual downstream consumer and the parent cache object. |
| Modifier and Type | Method and Description |
|---|---|
| public void | dispose()
Implements io. |
| public boolean | isDisposed()
Implements io. |
| disposed | back to summary |
|---|---|
| pack-priv volatile boolean disposed | |
| downstream | back to summary |
|---|---|
| pack-priv final Observer<? super T> downstream | |
| index | back to summary |
|---|---|
| pack-priv long index | |
| node | back to summary |
|---|---|
| pack-priv ObservableCache. | |
| offset | back to summary |
|---|---|
| pack-priv int offset | |
| parent | back to summary |
|---|---|
| pack-priv final ObservableCache<T> parent | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. | |
| CacheDisposable | back to summary |
|---|---|
| pack-priv CacheDisposable(Observer<? super T> downstream, ObservableCache<T> parent) Constructs a new instance with the actual downstream consumer and the parent cache object.
| |
| dispose | back to summary |
|---|---|
| public void dispose() Implements io. Doc from io. Dispose the resource, the operation should be idempotent.
| |
| isDisposed | back to summary |
|---|---|
| public boolean isDisposed() Implements io. Doc from io. Returns true if this resource has been disposed.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv volatile ObservableCache. | next
The next node if not null. |
| pack-priv final T[] | values
The array of values held by this node. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| next | back to summary |
|---|---|
| pack-priv volatile ObservableCache. The next node if not null. | |
| values | back to summary |
|---|---|
| pack-priv final T[] values The array of values held by this node. | |
| Node | back to summary |
|---|---|
pack-priv Node(int capacityHint)
| |