io.reactivex.rxjava3.internal.operators.flowable.FlowableWindowBoundarySelector Maven / Gradle / Ivy
/*
* Copyright (c) 2016-present, RxJava Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
* the License for the specific language governing permissions and limitations under the License.
*/
package io.reactivex.rxjava3.internal.operators.flowable;
import java.util.*;
import java.util.concurrent.atomic.*;
import org.reactivestreams.*;
import io.reactivex.rxjava3.core.*;
import io.reactivex.rxjava3.disposables.*;
import io.reactivex.rxjava3.exceptions.*;
import io.reactivex.rxjava3.functions.Function;
import io.reactivex.rxjava3.internal.queue.MpscLinkedQueue;
import io.reactivex.rxjava3.internal.subscriptions.SubscriptionHelper;
import io.reactivex.rxjava3.internal.util.*;
import io.reactivex.rxjava3.operators.SimplePlainQueue;
import io.reactivex.rxjava3.plugins.RxJavaPlugins;
import io.reactivex.rxjava3.processors.UnicastProcessor;
public final class FlowableWindowBoundarySelector extends AbstractFlowableWithUpstream> {
final Publisher open;
final Function super B, ? extends Publisher> closingIndicator;
final int bufferSize;
public FlowableWindowBoundarySelector(
Flowable source,
Publisher open, Function super B, ? extends Publisher> closingIndicator,
int bufferSize) {
super(source);
this.open = open;
this.closingIndicator = closingIndicator;
this.bufferSize = bufferSize;
}
@Override
protected void subscribeActual(Subscriber super Flowable> s) {
source.subscribe(new WindowBoundaryMainSubscriber<>(
s, open, closingIndicator, bufferSize));
}
static final class WindowBoundaryMainSubscriber
extends AtomicInteger
implements FlowableSubscriber, Subscription, Runnable {
private static final long serialVersionUID = 8646217640096099753L;
final Subscriber super Flowable> downstream;
final Publisher open;
final Function super B, ? extends Publisher> closingIndicator;
final int bufferSize;
final CompositeDisposable resources;
final WindowStartSubscriber startSubscriber;
final List> windows;
final SimplePlainQueue
© 2015 - 2025 Weber Informatics LLC | Privacy Policy