use of io.servicetalk.concurrent.internal.ConcurrentSubscription in project servicetalk by apple.
the class WriteStreamSubscriber method onSubscribe.
@Override
public void onSubscribe(Subscription s) {
final Subscription concurrentSubscription = ConcurrentSubscription.wrap(s);
if (!subscriptionUpdater.compareAndSet(this, null, concurrentSubscription)) {
// Either onSubscribe was called twice or Subscription is cancelled, in both cases, we cancel the new
// Subscription.
s.cancel();
return;
}
subscriber.onSubscribe(concurrentSubscription);
if (eventLoop.inEventLoop()) {
initialRequestN(concurrentSubscription);
} else {
eventLoop.execute(() -> initialRequestN(concurrentSubscription));
}
}
Aggregations