Class OperatorMerge<T>
- java.lang.Object
-
- rx.internal.operators.OperatorMerge<T>
-
- Type Parameters:
T
- the type of the items emitted by both the source and mergedObservable
s
- All Implemented Interfaces:
Func1<Subscriber<? super T>,Subscriber<? super Observable<? extends T>>>
,Function
,Observable.Operator<T,Observable<? extends T>>
public final class OperatorMerge<T> extends java.lang.Object implements Observable.Operator<T,Observable<? extends T>>
Flattens a list ofObservable
s into oneObservable
, without any transformation.You can combine the items emitted by multiple
Observable
s so that they act like a singleObservable
, by using the merge operation.The
instance(true)
call behaves likeOperatorMerge
except that if any of the merged Observables notify of an error viaonError
,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 theonError
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
OperatorMerge.HolderDelayErrors
Lazy initialization via inner-class holder.(package private) static class
OperatorMerge.HolderNoDelay
Lazy initialization via inner-class holder.(package private) static class
OperatorMerge.InnerSubscriber<T>
(package private) static class
OperatorMerge.MergeProducer<T>
(package private) static class
OperatorMerge.MergeSubscriber<T>
The subscriber that observes Observables.
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
delayErrors
(package private) int
maxConcurrent
-
Constructor Summary
Constructors Constructor Description OperatorMerge(boolean delayErrors, int maxConcurrent)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Subscriber<Observable<? extends T>>
call(Subscriber<? super T> child)
static <T> OperatorMerge<T>
instance(boolean delayErrors)
static <T> OperatorMerge<T>
instance(boolean delayErrors, int maxConcurrent)
Creates a new instance of the operator with the given delayError and maxConcurrency settings.
-
-
-
Method Detail
-
instance
public static <T> OperatorMerge<T> instance(boolean delayErrors)
- Type Parameters:
T
- the common value type- Parameters:
delayErrors
- should the merge delay errors?- Returns:
- a singleton instance of this stateless operator.
-
instance
public static <T> OperatorMerge<T> instance(boolean delayErrors, int maxConcurrent)
Creates a new instance of the operator with the given delayError and maxConcurrency settings.- Type Parameters:
T
- the value type- Parameters:
delayErrors
-maxConcurrent
- the maximum number of concurrent subscriptions or Integer.MAX_VALUE for unlimited- Returns:
- the Operator instance with the given settings
-
call
public Subscriber<Observable<? extends T>> call(Subscriber<? super T> child)
- Specified by:
call
in interfaceFunc1<Subscriber<? super T>,Subscriber<? super Observable<? extends T>>>
-
-