File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
main/java/io/reactivex/rxjava3/internal/operators/flowable
test/java/io/reactivex/rxjava3/internal/operators/flowable Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ public void onNext(T t) {
65
65
downstream .onNext (t );
66
66
BackpressureHelper .produced (this , 1 );
67
67
} else {
68
+ upstream .cancel ();
68
69
onError (new MissingBackpressureException ("could not emit value due to lack of requests" ));
69
70
}
70
71
}
Original file line number Diff line number Diff line change 13
13
14
14
package io .reactivex .rxjava3 .internal .operators .flowable ;
15
15
16
+ import static org .junit .Assert .*;
17
+
16
18
import org .junit .Test ;
17
19
import org .reactivestreams .Publisher ;
18
20
19
21
import io .reactivex .rxjava3 .core .*;
22
+ import io .reactivex .rxjava3 .exceptions .MissingBackpressureException ;
20
23
import io .reactivex .rxjava3 .functions .Function ;
24
+ import io .reactivex .rxjava3 .subjects .PublishSubject ;
25
+ import io .reactivex .rxjava3 .subscribers .TestSubscriber ;
21
26
import io .reactivex .rxjava3 .testsupport .TestHelper ;
22
27
23
28
public class FlowableOnBackpressureErrorTest extends RxJavaTest {
@@ -51,4 +56,20 @@ public Object apply(Flowable<Integer> f) throws Exception {
51
56
}
52
57
}, false , 1 , 1 , 1 );
53
58
}
59
+
60
+ @ Test
61
+ public void overflowCancels () {
62
+ PublishSubject <Integer > ps = PublishSubject .create ();
63
+
64
+ TestSubscriber <Integer > ts = ps .toFlowable (BackpressureStrategy .ERROR )
65
+ .test (0L );
66
+
67
+ assertTrue (ps .hasObservers ());
68
+
69
+ ps .onNext (1 );
70
+
71
+ assertFalse (ps .hasObservers ());
72
+
73
+ ts .assertFailure (MissingBackpressureException .class );
74
+ }
54
75
}
You can’t perform that action at this time.
0 commit comments