@@ -5332,14 +5332,23 @@ public final Observable<T> onBackpressureDrop() {
5332
5332
* <p>
5333
5333
* Note that if the upstream Observable does support backpressure, this operator ignores that capability
5334
5334
* and doesn't propagate any backpressure requests from downstream.
5335
+ * <p>
5336
+ * Warning! Using a chain like {@code source.onBackpressureBlock().subscribeOn(scheduler)} is prone to
5337
+ * deadlocks because the consumption of the internal queue is scheduled behind a blocked emission by
5338
+ * the subscribeOn. In order to avoid this, the operators have to be swapped in the chain:
5339
+ * {@code source.subscribeOn(scheduler).onBackpressureBlock()} and in general, no subscribeOn operator should follow
5340
+ * this operator.
5335
5341
*
5336
5342
* @param maxQueueLength the maximum number of items the producer can emit without blocking
5337
5343
* @return the source Observable modified to block {@code onNext} notifications on overflow
5338
5344
* @see <a href="http://reactivex.io/documentation/operators/backpressure.html">ReactiveX operators documentation: backpressure operators</a>
5339
- * @Experimental The behavior of this can change at any time.
5345
+ * @Experimental The behavior of this can change at any time.
5346
+ * @deprecated The operator doesn't work properly with {@link #subscribeOn(Scheduler)} and is prone to
5347
+ * deadlocks. It will be removed/unavailable starting from 1.1.
5340
5348
* @since (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
5341
5349
*/
5342
5350
@ Experimental
5351
+ @ Deprecated
5343
5352
public final Observable <T > onBackpressureBlock (int maxQueueLength ) {
5344
5353
return lift (new OperatorOnBackpressureBlock <T >(maxQueueLength ));
5345
5354
}
@@ -5355,13 +5364,22 @@ public final Observable<T> onBackpressureBlock(int maxQueueLength) {
5355
5364
* <p>
5356
5365
* Note that if the upstream Observable does support backpressure, this operator ignores that capability
5357
5366
* and doesn't propagate any backpressure requests from downstream.
5367
+ * <p>
5368
+ * Warning! Using a chain like {@code source.onBackpressureBlock().subscribeOn(scheduler)} is prone to
5369
+ * deadlocks because the consumption of the internal queue is scheduled behind a blocked emission by
5370
+ * the subscribeOn. In order to avoid this, the operators have to be swapped in the chain:
5371
+ * {@code source.subscribeOn(scheduler).onBackpressureBlock()} and in general, no subscribeOn operator should follow
5372
+ * this operator.
5358
5373
*
5359
5374
* @return the source Observable modified to block {@code onNext} notifications on overflow
5360
5375
* @see <a href="http://reactivex.io/documentation/operators/backpressure.html">ReactiveX operators documentation: backpressure operators</a>
5361
5376
* @Experimental The behavior of this can change at any time.
5377
+ * @deprecated The operator doesn't work properly with {@link #subscribeOn(Scheduler)} and is prone to
5378
+ * deadlocks. It will be removed/unavailable starting from 1.1.
5362
5379
* @since (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
5363
5380
*/
5364
5381
@ Experimental
5382
+ @ Deprecated
5365
5383
public final Observable <T > onBackpressureBlock () {
5366
5384
return onBackpressureBlock (rx .internal .util .RxRingBuffer .SIZE );
5367
5385
}
0 commit comments