@@ -2215,20 +2215,20 @@ public void fusedNoConcurrentCleanDueToCancel() {
2215
2215
try {
2216
2216
final PublishProcessor <Integer > pp = PublishProcessor .create ();
2217
2217
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 >>>();
2219
2219
2220
2220
final TestSubscriber <Integer > ts2 = new TestSubscriber <Integer >();
2221
2221
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 >>() {
2224
2224
2225
2225
boolean once ;
2226
2226
2227
2227
@ Override
2228
- public void onNext (GroupedFlowable <Object , Integer > g ) {
2228
+ public void onNext (GroupedFlowable <Integer , Integer > g ) {
2229
2229
if (!once ) {
2230
2230
try {
2231
- GroupedFlowable <Object , Integer > t = qs .get ().poll ();
2231
+ GroupedFlowable <Integer , Integer > t = qs .get ().poll ();
2232
2232
if (t != null ) {
2233
2233
once = true ;
2234
2234
t .subscribe (ts2 );
@@ -2250,7 +2250,7 @@ public void onComplete() {
2250
2250
@ Override
2251
2251
public void onSubscribe (Subscription s ) {
2252
2252
@ SuppressWarnings ("unchecked" )
2253
- QueueSubscription <GroupedFlowable <Object , Integer >> q = (QueueSubscription <GroupedFlowable <Object , Integer >>)s ;
2253
+ QueueSubscription <GroupedFlowable <Integer , Integer >> q = (QueueSubscription <GroupedFlowable <Integer , Integer >>)s ;
2254
2254
qs .set (q );
2255
2255
q .requestFusion (QueueFuseable .ANY );
2256
2256
q .request (1 );
@@ -2316,4 +2316,38 @@ public Publisher<Integer> apply(GroupedFlowable<Integer, Integer> g) {
2316
2316
.assertComplete ()
2317
2317
.assertNoErrors ();
2318
2318
}
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
+ }
2319
2353
}
0 commit comments