File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
src/test/java/rx/internal/operators Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,8 @@ public void call(final Subscriber<? super String> o) {
397
397
final AtomicLong req = new AtomicLong ();
398
398
// 0 = not set, 1 = fast path, 2 = backpressure
399
399
final AtomicInteger path = new AtomicInteger (0 );
400
+ volatile boolean done = false ;
401
+
400
402
@ Override
401
403
public void request (long n ) {
402
404
if (n == Long .MAX_VALUE && path .compareAndSet (0 , 1 )) {
@@ -410,11 +412,12 @@ public void request(long n) {
410
412
}
411
413
return ;
412
414
}
413
- if (n > 0 && req .getAndAdd (n ) == 0 && (path .get () == 2 || path .compareAndSet (0 , 2 )) && !o . isUnsubscribed () ) {
415
+ if (n > 0 && req .getAndAdd (n ) == 0 && (path .get () == 2 || path .compareAndSet (0 , 2 )) && !done ) {
414
416
int i = count .getAndIncrement ();
415
417
if (i < numFailures ) {
416
418
o .onNext ("beginningEveryTime" );
417
419
o .onError (new RuntimeException ("forced failure: " + (i + 1 )));
420
+ done = true ;
418
421
} else {
419
422
do {
420
423
if (i == numFailures ) {
@@ -423,6 +426,7 @@ public void request(long n) {
423
426
if (i > numFailures ) {
424
427
o .onNext ("onSuccessOnly" );
425
428
o .onCompleted ();
429
+ done = true ;
426
430
break ;
427
431
}
428
432
i = count .getAndIncrement ();
You can’t perform that action at this time.
0 commit comments