Observables
Observables into one Observable, without any transformation.
You can combine the items emitted by multiple Observables so that they act like a single Observable, by using the merge operation.
The instance(true) call behaves like OperatorMerge except that if any of the merged Observables notify of
an error via onError, mergeDelayError will refrain from propagating that error
notification until all of the merged Observables have finished emitting items.
Even if multiple merged Observables send onError notifications, mergeDelayError will
only invoke the onError method of its Observers once.
This operation allows an Observer to receive all successfully emitted items from all of the source Observables without being interrupted by an error notification from one of them.
Note
If this is used on an Observable that never completes, it will never call onError and will effectively swallow errors.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | OperatorMerge.HolderDelayErrors
Lazy initialization via inner-class holder. |
| pack-priv static class | OperatorMerge.HolderNoDelay
Lazy initialization via inner-class holder. |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final boolean | |
| pack-priv final int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Subscriber | |
| public static < the common value type T> OperatorMerge | Returns: a singleton instance of this stateless operator.should the merge delay errors? delayErrors)
|
| public static < the value type T> OperatorMerge | Returns: the Operator instance with the given settingsif true, errors are delayed till all sources terminate, if false the first error will
be emitted and all sequences unsubscribed delayErrors, int the maximum number of concurrent subscriptions or Integer.MAX_VALUE for unlimited maxConcurrent)Creates a new instance of the operator with the given delayError and maxConcurrency settings. |
| delayErrors | back to summary |
|---|---|
| pack-priv final boolean delayErrors | |
| maxConcurrent | back to summary |
|---|---|
| pack-priv final int maxConcurrent | |
| OperatorMerge | back to summary |
|---|---|
| pack-priv OperatorMerge(boolean delayErrors, int maxConcurrent) | |
| call | back to summary |
|---|---|
| public Subscriber Implements rx.
| |
| instance | back to summary |
|---|---|
public static <T> OperatorMerge
| |
| instance | back to summary |
|---|---|
| public static <T> OperatorMerge Creates a new instance of the operator with the given delayError and maxConcurrency settings.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final OperatorMerge | INSTANCE
A singleton instance. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| INSTANCE | back to summary |
|---|---|
| pack-priv static final OperatorMerge<Object> INSTANCE A singleton instance. | |
| HolderDelayErrors | back to summary |
|---|---|
| pack-priv HolderDelayErrors() | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final OperatorMerge | INSTANCE
A singleton instance. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| INSTANCE | back to summary |
|---|---|
| pack-priv static final OperatorMerge<Object> INSTANCE A singleton instance. | |
| HolderNoDelay | back to summary |
|---|---|
| pack-priv HolderNoDelay() | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv volatile boolean | |
| pack-priv final long | |
| pack-priv static final int | |
| pack-priv int | |
| pack-priv final OperatorMerge. | |
| pack-priv volatile RxRingBuffer |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| 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 | onStart()
Overrides rx. |
| public void |
| done | back to summary |
|---|---|
| pack-priv volatile boolean done | |
| id | back to summary |
|---|---|
| pack-priv final long id | |
| LIMIT | back to summary |
|---|---|
| pack-priv static final int LIMIT | |
| outstanding | back to summary |
|---|---|
| pack-priv int outstanding | |
| parent | back to summary |
|---|---|
| pack-priv final OperatorMerge. | |
| queue | back to summary |
|---|---|
| pack-priv volatile RxRingBuffer queue | |
| InnerSubscriber | back to summary |
|---|---|
| public InnerSubscriber(OperatorMerge. | |
| 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
| |
| onStart | back to summary |
|---|---|
| public void onStart() Overrides rx. Doc from rx. This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber. Override this method to add any useful initialization to your subscription, for instance to initiate backpressure.
| |
| requestMore | back to summary |
|---|---|
| public void requestMore(long n) | |
| Modifier and Type | Field and Description |
|---|---|
| private static final long | |
| pack-priv final OperatorMerge. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| 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. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. | |
| subscriber | back to summary |
|---|---|
| pack-priv final OperatorMerge. | |
| MergeProducer | back to summary |
|---|---|
| public MergeProducer(OperatorMerge. | |
| produced | back to summary |
|---|---|
| public long produced(int n) | |
| 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);
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final Subscriber | |
| pack-priv final boolean | |
| pack-priv volatile boolean | |
| pack-priv boolean | emitting
Guarded by this. |
| pack-priv static final OperatorMerge. | EMPTY
An empty array to avoid creating new empty arrays in removeInner. |
| pack-priv volatile ConcurrentLinkedQueue | errors
Due to the emission loop, we need to store errors somewhere if !delayErrors. |
| pack-priv final Object | |
| pack-priv volatile OperatorMerge. | innerSubscribers
Copy-on-write array, guarded by innerGuard. |
| pack-priv long | lastId
Which was the last InnerSubscriber that emitted? |
| pack-priv int | lastIndex
What was its index in the innerSubscribers array? |
| pack-priv final int | |
| pack-priv boolean | missed
Guarded by this. |
| pack-priv OperatorMerge. | |
| pack-priv volatile Queue | |
| pack-priv int | |
| pack-priv final int | |
| pack-priv volatile CompositeSubscription | subscriptions
Hides rx. |
| pack-priv long | uniqueId
Used to generate unique InnerSubscriber IDs. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| pack-priv boolean | Returns: true if the child unsubscribed or there are errors available and merge doesn't delay errors.Check if the operator reached some terminal state: child unsubscribed, an error was reported and we don't delay errors. |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| protected void | |
| protected void | |
| pack-priv CompositeSubscription | |
| pack-priv Queue | |
| 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(Observable<? extends T>
the item emitted by the Observable t)Implements rx. |
| protected void | |
| protected void | |
| pack-priv void | |
| private void | |
| public void | |
| pack-priv void | tryEmit(OperatorMerge.
the subscriber to one of the inner Observables running subscriber,the value that inner Observable produced value)Tries to emit the value directly to the child if no concurrent emission is happening at the moment. |
| pack-priv void | tryEmit(T
the scalar value the main Observable emitted through value)just()Tries to emit the value directly to the child if no concurrent emission is happening at the moment. |
| child | back to summary |
|---|---|
| pack-priv final Subscriber<? super T> child | |
| delayErrors | back to summary |
|---|---|
| pack-priv final boolean delayErrors | |
| done | back to summary |
|---|---|
| pack-priv volatile boolean done | |
| emitting | back to summary |
|---|---|
| pack-priv boolean emitting Guarded by this. | |
| EMPTY | back to summary |
|---|---|
| pack-priv static final OperatorMerge. An empty array to avoid creating new empty arrays in removeInner. | |
| errors | back to summary |
|---|---|
| pack-priv volatile ConcurrentLinkedQueue<Throwable> errors Due to the emission loop, we need to store errors somewhere if !delayErrors. | |
| innerGuard | back to summary |
|---|---|
| pack-priv final Object innerGuard | |
| innerSubscribers | back to summary |
|---|---|
| pack-priv volatile OperatorMerge. Copy-on-write array, guarded by innerGuard. | |
| lastId | back to summary |
|---|---|
| pack-priv long lastId Which was the last InnerSubscriber that emitted? Accessed if emitting == true. | |
| lastIndex | back to summary |
|---|---|
| pack-priv int lastIndex What was its index in the innerSubscribers array? Accessed if emitting == true. | |
| maxConcurrent | back to summary |
|---|---|
| pack-priv final int maxConcurrent | |
| missed | back to summary |
|---|---|
| pack-priv boolean missed Guarded by this. | |
| producer | back to summary |
|---|---|
| pack-priv OperatorMerge. Hides rx. | |
| queue | back to summary |
|---|---|
| pack-priv volatile Queue<Object> queue | |
| scalarEmissionCount | back to summary |
|---|---|
| pack-priv int scalarEmissionCount | |
| scalarEmissionLimit | back to summary |
|---|---|
| pack-priv final int scalarEmissionLimit | |
| subscriptions | back to summary |
|---|---|
| pack-priv volatile CompositeSubscription subscriptions Hides rx. Tracks the active subscriptions to sources. | |
| uniqueId | back to summary |
|---|---|
| pack-priv long uniqueId Used to generate unique InnerSubscriber IDs. Modified from onNext only. | |
| MergeSubscriber | back to summary |
|---|---|
| public MergeSubscriber(Subscriber<? super T> child, boolean delayErrors, int maxConcurrent) | |
| addInner | back to summary |
|---|---|
| pack-priv void addInner(OperatorMerge. | |
| checkTerminate | back to summary |
|---|---|
| pack-priv boolean checkTerminate() Check if the operator reached some terminal state: child unsubscribed, an error was reported and we don't delay errors.
| |
| emit | back to summary |
|---|---|
| pack-priv void emit() | |
| emitEmpty | back to summary |
|---|---|
| pack-priv void emitEmpty() | |
| emitLoop | back to summary |
|---|---|
| pack-priv void emitLoop() The standard emission loop serializing events and requests. | |
| emitScalar | back to summary |
|---|---|
| protected void emitScalar(OperatorMerge. | |
| emitScalar | back to summary |
|---|---|
| protected void emitScalar(T value, long r) | |
| getOrCreateComposite | back to summary |
|---|---|
| pack-priv CompositeSubscription getOrCreateComposite() | |
| getOrCreateErrorQueue | back to summary |
|---|---|
| pack-priv Queue | |
| 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(Observable<? extends T> t) Implements rx. Doc from rx. Provides the Observer with a new item to observe.
The
The
| |
| queueScalar | back to summary |
|---|---|
| protected void queueScalar(OperatorMerge. | |
| queueScalar | back to summary |
|---|---|
| protected void queueScalar(T value) | |
| removeInner | back to summary |
|---|---|
| pack-priv void removeInner(OperatorMerge. | |
| reportError | back to summary |
|---|---|
| private void reportError() | |
| requestMore | back to summary |
|---|---|
| public void requestMore(long n) | |
| tryEmit | back to summary |
|---|---|
| pack-priv void tryEmit(OperatorMerge. Tries to emit the value directly to the child if no concurrent emission is happening at the moment. Since the scalar-value queue optimization applies to both the main source and the inner subscribers, we handle things in a shared manner.
| |
| tryEmit | back to summary |
|---|---|
| pack-priv void tryEmit(T value) Tries to emit the value directly to the child if no concurrent emission is happening at the moment. Since the scalar-value queue optimization applies to both the main source and the inner subscribers, we handle things in a shared manner.
| |