52
52
import rx .operators .OnSubscribeFromIterable ;
53
53
import rx .operators .OnSubscribeRange ;
54
54
import rx .operators .OperationAll ;
55
- import rx .operators .OperatorAmb ;
56
55
import rx .operators .OperationAny ;
57
56
import rx .operators .OperationAsObservable ;
58
57
import rx .operators .OperationAverage ;
91
90
import rx .operators .OperationSkip ;
92
91
import rx .operators .OperationSkipLast ;
93
92
import rx .operators .OperationSkipUntil ;
94
- import rx .operators .OperatorSkipWhile ;
95
93
import rx .operators .OperationSum ;
96
94
import rx .operators .OperationSwitch ;
97
- import rx .operators .OperationSynchronize ;
98
95
import rx .operators .OperationTakeLast ;
99
96
import rx .operators .OperationTakeTimed ;
100
97
import rx .operators .OperationTakeUntil ;
107
104
import rx .operators .OperationToObservableFuture ;
108
105
import rx .operators .OperationUsing ;
109
106
import rx .operators .OperationWindow ;
107
+ import rx .operators .OperatorAmb ;
110
108
import rx .operators .OperatorCast ;
111
109
import rx .operators .OperatorDoOnEach ;
112
110
import rx .operators .OperatorFilter ;
120
118
import rx .operators .OperatorRepeat ;
121
119
import rx .operators .OperatorRetry ;
122
120
import rx .operators .OperatorScan ;
121
+ import rx .operators .OperatorSerialize ;
123
122
import rx .operators .OperatorSkip ;
123
+ import rx .operators .OperatorSkipWhile ;
124
124
import rx .operators .OperatorSubscribeOn ;
125
+ import rx .operators .OperatorSynchronize ;
125
126
import rx .operators .OperatorTake ;
126
127
import rx .operators .OperatorTimeout ;
127
128
import rx .operators .OperatorTimeoutWithSelector ;
@@ -2712,7 +2713,7 @@ public final static <T> Observable<T> switchOnNext(Observable<? extends Observab
2712
2713
*/
2713
2714
@ Deprecated
2714
2715
public final static <T > Observable <T > synchronize (Observable <T > source ) {
2715
- return create ( OperationSynchronize .synchronize (source ) );
2716
+ return source .synchronize ();
2716
2717
}
2717
2718
2718
2719
/**
@@ -6197,6 +6198,10 @@ public final <R> Observable<R> scan(R initialValue, Func2<R, ? super T, R> accum
6197
6198
return lift (new OperatorScan <R , T >(initialValue , accumulator ));
6198
6199
}
6199
6200
6201
+ public final Observable <T > serialize () {
6202
+ return lift (new OperatorSerialize <T >());
6203
+ }
6204
+
6200
6205
/**
6201
6206
* If the source Observable completes after emitting a single item, return an Observable that emits that
6202
6207
* 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<?
7259
7264
* @return an Observable that is a chronologically well-behaved version of the source Observable, and that
7260
7265
* synchronously notifies its {@link Observer}s
7261
7266
* @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.
7262
7268
*/
7263
7269
public final Observable <T > synchronize () {
7264
- return create ( OperationSynchronize . synchronize ( this ));
7270
+ return lift ( new OperatorSynchronize < T >( ));
7265
7271
}
7266
7272
7267
7273
/**
@@ -7283,9 +7289,10 @@ public final Observable<T> synchronize() {
7283
7289
* @return an Observable that is a chronologically well-behaved version of the source Observable, and that
7284
7290
* synchronously notifies its {@link Observer}s
7285
7291
* @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.
7286
7293
*/
7287
7294
public final Observable <T > synchronize (Object lock ) {
7288
- return create ( OperationSynchronize . synchronize ( this , lock ));
7295
+ return lift ( new OperatorSynchronize < T >( lock ));
7289
7296
}
7290
7297
7291
7298
/**
0 commit comments