@@ -2215,20 +2215,20 @@ public void fusedNoConcurrentCleanDueToCancel() {
22152215 try {
22162216 final PublishProcessor <Integer > pp = PublishProcessor .create ();
22172217
2218- final AtomicReference <QueueSubscription <GroupedFlowable <Object , Integer >>> qs = new AtomicReference <QueueSubscription <GroupedFlowable <Object , Integer >>>();
2218+ final AtomicReference <QueueSubscription <GroupedFlowable <Integer , Integer >>> qs = new AtomicReference <QueueSubscription <GroupedFlowable <Integer , Integer >>>();
22192219
22202220 final TestSubscriber <Integer > ts2 = new TestSubscriber <Integer >();
22212221
2222- pp .groupBy (Functions .identity (), Functions .<Integer >identity (), false , 4 )
2223- .subscribe (new FlowableSubscriber <GroupedFlowable <Object , Integer >>() {
2222+ pp .groupBy (Functions .< Integer > identity (), Functions .<Integer >identity (), false , 4 )
2223+ .subscribe (new FlowableSubscriber <GroupedFlowable <Integer , Integer >>() {
22242224
22252225 boolean once ;
22262226
22272227 @ Override
2228- public void onNext (GroupedFlowable <Object , Integer > g ) {
2228+ public void onNext (GroupedFlowable <Integer , Integer > g ) {
22292229 if (!once ) {
22302230 try {
2231- GroupedFlowable <Object , Integer > t = qs .get ().poll ();
2231+ GroupedFlowable <Integer , Integer > t = qs .get ().poll ();
22322232 if (t != null ) {
22332233 once = true ;
22342234 t .subscribe (ts2 );
@@ -2250,7 +2250,7 @@ public void onComplete() {
22502250 @ Override
22512251 public void onSubscribe (Subscription s ) {
22522252 @ SuppressWarnings ("unchecked" )
2253- QueueSubscription <GroupedFlowable <Object , Integer >> q = (QueueSubscription <GroupedFlowable <Object , Integer >>)s ;
2253+ QueueSubscription <GroupedFlowable <Integer , Integer >> q = (QueueSubscription <GroupedFlowable <Integer , Integer >>)s ;
22542254 qs .set (q );
22552255 q .requestFusion (QueueFuseable .ANY );
22562256 q .request (1 );
@@ -2316,4 +2316,38 @@ public Publisher<Integer> apply(GroupedFlowable<Integer, Integer> g) {
23162316 .assertComplete ()
23172317 .assertNoErrors ();
23182318 }
2319+
2320+ @ Test
2321+ public void cancelledGroupResumesRequesting () {
2322+ final List <TestSubscriber <Integer >> tss = new ArrayList <TestSubscriber <Integer >>();
2323+ final AtomicInteger counter = new AtomicInteger ();
2324+ final AtomicBoolean done = new AtomicBoolean ();
2325+ Flowable .range (1 , 1000 )
2326+ .doOnNext (new Consumer <Integer >() {
2327+ @ Override
2328+ public void accept (Integer v ) throws Exception {
2329+ counter .getAndIncrement ();
2330+ }
2331+ })
2332+ .groupBy (Functions .justFunction (1 ))
2333+ .subscribe (new Consumer <GroupedFlowable <Integer , Integer >>() {
2334+ @ Override
2335+ public void accept (GroupedFlowable <Integer , Integer > v ) throws Exception {
2336+ TestSubscriber <Integer > ts = TestSubscriber .create (0L );
2337+ tss .add (ts );
2338+ v .subscribe (ts );
2339+ }
2340+ }, Functions .emptyConsumer (), new Action () {
2341+ @ Override
2342+ public void run () throws Exception {
2343+ done .set (true );
2344+ }
2345+ });
2346+
2347+ while (!done .get ()) {
2348+ tss .remove (0 ).cancel ();
2349+ }
2350+
2351+ assertEquals (1000 , counter .get ());
2352+ }
23192353}
0 commit comments