5252import rx .operators .OnSubscribeFromIterable ;
5353import rx .operators .OnSubscribeRange ;
5454import rx .operators .OperationAll ;
55- import rx .operators .OperatorAmb ;
5655import rx .operators .OperationAny ;
5756import rx .operators .OperationAsObservable ;
5857import rx .operators .OperationAverage ;
9190import rx .operators .OperationSkip ;
9291import rx .operators .OperationSkipLast ;
9392import rx .operators .OperationSkipUntil ;
94- import rx .operators .OperatorSkipWhile ;
9593import rx .operators .OperationSum ;
9694import rx .operators .OperationSwitch ;
97- import rx .operators .OperationSynchronize ;
9895import rx .operators .OperationTakeLast ;
9996import rx .operators .OperationTakeTimed ;
10097import rx .operators .OperationTakeUntil ;
107104import rx .operators .OperationToObservableFuture ;
108105import rx .operators .OperationUsing ;
109106import rx .operators .OperationWindow ;
107+ import rx .operators .OperatorAmb ;
110108import rx .operators .OperatorCast ;
111109import rx .operators .OperatorDoOnEach ;
112110import rx .operators .OperatorFilter ;
120118import rx .operators .OperatorRepeat ;
121119import rx .operators .OperatorRetry ;
122120import rx .operators .OperatorScan ;
121+ import rx .operators .OperatorSerialize ;
123122import rx .operators .OperatorSkip ;
123+ import rx .operators .OperatorSkipWhile ;
124124import rx .operators .OperatorSubscribeOn ;
125+ import rx .operators .OperatorSynchronize ;
125126import rx .operators .OperatorTake ;
126127import rx .operators .OperatorTimeout ;
127128import rx .operators .OperatorTimeoutWithSelector ;
@@ -2712,7 +2713,7 @@ public final static <T> Observable<T> switchOnNext(Observable<? extends Observab
27122713 */
27132714 @ Deprecated
27142715 public final static <T > Observable <T > synchronize (Observable <T > source ) {
2715- return create ( OperationSynchronize .synchronize (source ) );
2716+ return source .synchronize ();
27162717 }
27172718
27182719 /**
@@ -6197,6 +6198,10 @@ public final <R> Observable<R> scan(R initialValue, Func2<R, ? super T, R> accum
61976198 return lift (new OperatorScan <R , T >(initialValue , accumulator ));
61986199 }
61996200
6201+ public final Observable <T > serialize () {
6202+ return lift (new OperatorSerialize <T >());
6203+ }
6204+
62006205 /**
62016206 * If the source Observable completes after emitting a single item, return an Observable that emits that
62026207 * item. If the source Observable emits more than one item or no items, throw an
@@ -7259,9 +7264,10 @@ public final <R> Observable<R> switchMap(Func1<? super T, ? extends Observable<?
72597264 * @return an Observable that is a chronologically well-behaved version of the source Observable, and that
72607265 * synchronously notifies its {@link Observer}s
72617266 * @see <a href="https://github.com/Netflix/RxJava/wiki/Observable-Utility-Operators#wiki-synchronize">RxJava Wiki: synchronize()</a>
7267+ * @deprecated Use {@link #serialize()} instead as it doesn't block threads while emitting notification.
72627268 */
72637269 public final Observable <T > synchronize () {
7264- return create ( OperationSynchronize . synchronize ( this ));
7270+ return lift ( new OperatorSynchronize < T >( ));
72657271 }
72667272
72677273 /**
@@ -7283,9 +7289,10 @@ public final Observable<T> synchronize() {
72837289 * @return an Observable that is a chronologically well-behaved version of the source Observable, and that
72847290 * synchronously notifies its {@link Observer}s
72857291 * @see <a href="https://github.com/Netflix/RxJava/wiki/Observable-Utility-Operators#wiki-synchronize">RxJava Wiki: synchronize()</a>
7292+ * @deprecated Use {@link #serialize()} instead as it doesn't block threads while emitting notification.
72867293 */
72877294 public final Observable <T > synchronize (Object lock ) {
7288- return create ( OperationSynchronize . synchronize ( this , lock ));
7295+ return lift ( new OperatorSynchronize < T >( lock ));
72897296 }
72907297
72917298 /**
0 commit comments