Closed
Description
io.reactivex.Observable#window(long, java.util.concurrent.TimeUnit, long)
Observable.create((ObservableOnSubscribe<Integer>) emitter -> {
emitter.onNext(0);
emitter.onNext(1);
TimeUnit.SECONDS.sleep(1);
emitter.onNext(2);
TimeUnit.SECONDS.sleep(6);
emitter.onNext(4);
emitter.onNext(5);
})
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.window(5,TimeUnit.SECONDS, 2)
.flatMapSingle(Observable::toList)
.subscribe(list -> System.out.println("list=" + list + " time: "
+ TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - l)
+ "s"));
Like the case of above, since 7 seconds, some empty arrays are expected,and "2" will be emited when the 5 seconds,but actually not.
list=[0, 1] time: 0s
list=[2, 4] time: 7s
There is nothing after 7 seconds, it make a confuse.
As the chart https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/window6.png
it says that the timeSpan still works after winow-max-size reached.