RxJava



rx.operators
Class OperationSynchronize<T>

java.lang.Object
  extended by rx.operators.OperationSynchronize<T>
Type Parameters:
T - The type of the observable sequence.

public final class OperationSynchronize<T>
extends java.lang.Object

Wraps an Observable in another Observable that ensures that the resulting Observable is chronologically well-behaved.

A well-behaved Observable does not interleave its invocations of the onNext, onCompleted, and onError methods of its Observers; it invokes onCompleted or onError only once; and it never invokes onNext after invoking either onCompleted or onError. The synchronize operation enforces this, and the Observable it returns invokes onNext and onCompleted or onError synchronously.

NOTE: Observable.create(rx.Observable.OnSubscribeFunc) already wraps Observables so this is generally redundant.


Constructor Summary
OperationSynchronize()
           
 
Method Summary
static
<T> Observable.OnSubscribeFunc<T>
synchronize(Observable<? extends T> observable)
          Accepts an observable and wraps it in another observable which ensures that the resulting observable is well-behaved.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationSynchronize

public OperationSynchronize()
Method Detail

synchronize

public static <T> Observable.OnSubscribeFunc<T> synchronize(Observable<? extends T> observable)
Accepts an observable and wraps it in another observable which ensures that the resulting observable is well-behaved. A well-behaved observable ensures onNext, onCompleted, or onError calls to its subscribers are not interleaved, onCompleted and onError are only called once respectively, and no onNext calls follow onCompleted and onError calls.

Type Parameters:
T -
Parameters:
observable -
Returns:
the wrapped synchronized observable sequence