28
28
import io .reactivex .rxjava3 .internal .subscriptions .SubscriptionHelper ;
29
29
import io .reactivex .rxjava3 .internal .util .BackpressureHelper ;
30
30
import io .reactivex .rxjava3 .processors .UnicastProcessor ;
31
- import io .reactivex .rxjava3 .subscribers .SerializedSubscriber ;
32
31
33
32
public final class FlowableWindowTimed <T > extends AbstractFlowableWithUpstream <T , Flowable <T >> {
34
33
final long timespan ;
@@ -53,23 +52,21 @@ public FlowableWindowTimed(Flowable<T> source,
53
52
}
54
53
55
54
@ Override
56
- protected void subscribeActual (Subscriber <? super Flowable <T >> s ) {
57
- SerializedSubscriber <Flowable <T >> actual = new SerializedSubscriber <Flowable <T >>(s );
58
-
55
+ protected void subscribeActual (Subscriber <? super Flowable <T >> downstream ) {
59
56
if (timespan == timeskip ) {
60
57
if (maxSize == Long .MAX_VALUE ) {
61
58
source .subscribe (new WindowExactUnboundedSubscriber <T >(
62
- actual ,
59
+ downstream ,
63
60
timespan , unit , scheduler , bufferSize ));
64
61
return ;
65
62
}
66
63
source .subscribe (new WindowExactBoundedSubscriber <T >(
67
- actual ,
64
+ downstream ,
68
65
timespan , unit , scheduler ,
69
66
bufferSize , maxSize , restartTimerOnMaxSize ));
70
67
return ;
71
68
}
72
- source .subscribe (new WindowSkipSubscriber <T >(actual ,
69
+ source .subscribe (new WindowSkipSubscriber <T >(downstream ,
73
70
timespan , timeskip , unit , scheduler .createWorker (), bufferSize ));
74
71
}
75
72
@@ -100,8 +97,8 @@ abstract static class AbstractWindowSubscriber<T>
100
97
101
98
final AtomicInteger windowCount ;
102
99
103
- AbstractWindowSubscriber (Subscriber <? super Flowable <T >> actual , long timespan , TimeUnit unit , int bufferSize ) {
104
- this .downstream = actual ;
100
+ AbstractWindowSubscriber (Subscriber <? super Flowable <T >> downstream , long timespan , TimeUnit unit , int bufferSize ) {
101
+ this .downstream = downstream ;
105
102
this .queue = new MpscLinkedQueue <Object >();
106
103
this .timespan = timespan ;
107
104
this .unit = unit ;
@@ -204,7 +201,7 @@ void createFirstWindow() {
204
201
205
202
emitted = 1 ;
206
203
207
- WindowSubscribeIntercept <T > intercept = new WindowSubscribeIntercept <T >(window );
204
+ FlowableWindowSubscribeIntercept <T > intercept = new FlowableWindowSubscribeIntercept <T >(window );
208
205
downstream .onNext (intercept );
209
206
210
207
timer .replace (scheduler .schedulePeriodicallyDirect (this , timespan , timespan , unit ));
@@ -293,7 +290,7 @@ else if (!isEmpty) {
293
290
window = UnicastProcessor .create (bufferSize , windowRunnable );
294
291
this .window = window ;
295
292
296
- WindowSubscribeIntercept <T > intercept = new WindowSubscribeIntercept <T >(window );
293
+ FlowableWindowSubscribeIntercept <T > intercept = new FlowableWindowSubscribeIntercept <T >(window );
297
294
downstream .onNext (intercept );
298
295
299
296
if (intercept .tryAbandon ()) {
@@ -372,7 +369,7 @@ void createFirstWindow() {
372
369
windowCount .getAndIncrement ();
373
370
window = UnicastProcessor .create (bufferSize , this );
374
371
375
- WindowSubscribeIntercept <T > intercept = new WindowSubscribeIntercept <T >(window );
372
+ FlowableWindowSubscribeIntercept <T > intercept = new FlowableWindowSubscribeIntercept <T >(window );
376
373
downstream .onNext (intercept );
377
374
378
375
Runnable boundaryTask = new WindowBoundaryRunnable (this , 1L );
@@ -510,7 +507,7 @@ UnicastProcessor<T> createNewWindow(UnicastProcessor<T> window) {
510
507
window = UnicastProcessor .create (bufferSize , this );
511
508
this .window = window ;
512
509
513
- WindowSubscribeIntercept <T > intercept = new WindowSubscribeIntercept <T >(window );
510
+ FlowableWindowSubscribeIntercept <T > intercept = new FlowableWindowSubscribeIntercept <T >(window );
514
511
downstream .onNext (intercept );
515
512
516
513
if (restartTimerOnMaxSize ) {
@@ -573,7 +570,7 @@ void createFirstWindow() {
573
570
UnicastProcessor <T > window = UnicastProcessor .create (bufferSize , this );
574
571
windows .add (window );
575
572
576
- WindowSubscribeIntercept <T > intercept = new WindowSubscribeIntercept <T >(window );
573
+ FlowableWindowSubscribeIntercept <T > intercept = new FlowableWindowSubscribeIntercept <T >(window );
577
574
downstream .onNext (intercept );
578
575
579
576
worker .schedule (new WindowBoundaryRunnable (this , false ), timespan , unit );
@@ -647,7 +644,7 @@ void drain() {
647
644
UnicastProcessor <T > window = UnicastProcessor .create (bufferSize , this );
648
645
windows .add (window );
649
646
650
- WindowSubscribeIntercept <T > intercept = new WindowSubscribeIntercept <T >(window );
647
+ FlowableWindowSubscribeIntercept <T > intercept = new FlowableWindowSubscribeIntercept <T >(window );
651
648
downstream .onNext (intercept );
652
649
653
650
worker .schedule (new WindowBoundaryRunnable (this , false ), timespan , unit );
0 commit comments