File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/test/java/rx/internal/operators Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -395,9 +395,11 @@ public static class FuncWithErrors implements Observable.OnSubscribe<String> {
395
395
public void call (final Subscriber <? super String > o ) {
396
396
o .setProducer (new Producer () {
397
397
final AtomicLong req = new AtomicLong ();
398
+ // 0 = not set, 1 = fast path, 2 = backpressure
399
+ final AtomicInteger path = new AtomicInteger (0 );
398
400
@ Override
399
401
public void request (long n ) {
400
- if (n == Long .MAX_VALUE ) {
402
+ if (n == Long .MAX_VALUE && path . compareAndSet ( 0 , 1 ) ) {
401
403
o .onNext ("beginningEveryTime" );
402
404
int i = count .getAndIncrement ();
403
405
if (i < numFailures ) {
@@ -408,7 +410,7 @@ public void request(long n) {
408
410
}
409
411
return ;
410
412
}
411
- if (n > 0 && req .getAndAdd (n ) == 0 ) {
413
+ if (n > 0 && req .getAndAdd (n ) == 0 && ( path . get () == 2 || path . compareAndSet ( 0 , 2 )) ) {
412
414
int i = count .getAndIncrement ();
413
415
if (i < numFailures ) {
414
416
o .onNext ("beginningEveryTime" );
You can’t perform that action at this time.
0 commit comments