Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2016-2023 VMware Inc. or its affiliates, All Rights Reserved.
*
* 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
*
* https://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 reactor.core.publisher;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import java.util.function.BiFunction;
import java.util.function.BiPredicate;
import java.util.function.Function;
import java.util.stream.Stream;
import org.reactivestreams.Publisher;
import org.reactivestreams.Subscriber;
import reactor.core.CoreSubscriber;
import reactor.core.Disposable;
import reactor.core.Disposables;
import reactor.core.Exceptions;
import reactor.core.Scannable;
import reactor.core.publisher.FluxGroupJoin.JoinSupport;
import reactor.core.publisher.FluxGroupJoin.LeftRightEndSubscriber;
import reactor.core.publisher.FluxGroupJoin.LeftRightSubscriber;
import reactor.util.annotation.Nullable;
import reactor.util.concurrent.Queues;
/**
* @see https://github.com/reactor/reactive-streams-commons
* @since 3.0
*/
final class FluxJoin extends
InternalFluxOperator {
final Publisher extends TRight> other;
final Function super TLeft, ? extends Publisher> leftEnd;
final Function super TRight, ? extends Publisher> rightEnd;
final BiFunction super TLeft, ? super TRight, ? extends R> resultSelector;
FluxJoin(Flux source,
Publisher extends TRight> other,
Function super TLeft, ? extends Publisher> leftEnd,
Function super TRight, ? extends Publisher> rightEnd,
BiFunction super TLeft, ? super TRight, ? extends R> resultSelector) {
super(source);
this.other = Operators.toFluxOrMono(Objects.requireNonNull(other, "other"));
this.leftEnd = Objects.requireNonNull(leftEnd, "leftEnd");
this.rightEnd = Objects.requireNonNull(rightEnd, "rightEnd");
this.resultSelector = Objects.requireNonNull(resultSelector, "resultSelector");
}
@Override
public CoreSubscriber super TLeft> subscribeOrReturn(CoreSubscriber super R> actual) {
JoinSubscription parent =
new JoinSubscription<>(actual,
leftEnd,
rightEnd,
resultSelector);
actual.onSubscribe(parent);
LeftRightSubscriber left = new LeftRightSubscriber(parent, true);
parent.cancellations.add(left);
LeftRightSubscriber right = new LeftRightSubscriber(parent, false);
parent.cancellations.add(right);
source.subscribe(left);
other.subscribe(right);
return null;
}
@Override
public Object scanUnsafe(Attr key) {
if (key == Attr.RUN_STYLE) return Attr.RunStyle.SYNC;
return super.scanUnsafe(key);
}
static final class JoinSubscription
implements JoinSupport {
final Queue