public final int getAndIncrement() { return indexUpdater.getAndIncrement(this) & Integer.MAX_VALUE; }
public final int getAndIncrement() { return indexUpdater.getAndIncrement(this) & Integer.MAX_VALUE; }
protected boolean incrementSubscribers() { return SUBSCRIBER_COUNT.getAndIncrement(this) == 0; }
public int getAndIncrementCurrentCount() { return CURRENT_COUNT.getAndIncrement( this ); }
@Override public void cancel() { if (!cancelled) { cancelled = true; if (WIP.getAndIncrement(this) == 0) { cancelAndCleanup(queue); } } }
final void drain() { if (WIP.getAndIncrement(this) != 0) { return; } drainLoop(); }
@Override void onCancel() { if (WIP.getAndIncrement(this) == 0) { Operators.onDiscardQueueWithClear(queue, ctx, null); } }
@Override protected void doNext(Publisher<? extends T> ev) { queue.add(Signal.<Publisher<? extends T>>next(ev)); if(WIP_UPDATER.getAndIncrement(this) == 0){ subscribeNext(); } }
/** * Open a resource unconditionally (i.e. accepting a connection on an open server). */ void openResourceUnconditionally() { int oldState = stateUpdater.getAndIncrement(this); if (log.isTraceEnabled()) { log.tracef("CAS %s %08x -> %08x", this, Integer.valueOf(oldState), Integer.valueOf(oldState + 1)); } }
@Override public void cancel() { if (!cancelled) { cancelled = true; cancelInner(firstSubscriber); cancelInner(secondSubscriber); if (WIP.getAndIncrement(this) == 0) { firstSubscriber.queue.clear(); secondSubscriber.queue.clear(); } } }
@Override public void onComplete() { try { queue.add(Signal.<Publisher<? extends T>>complete()); if (WIP_UPDATER.getAndIncrement(this) == 0) { subscribeNext(); } } catch (Exception e) { doError(e); } }
@Nullable WindowFlux<T> newWindowDeferred() { // if the main is cancelled, don't create new groups if (cancelled == 0) { WINDOW_COUNT.getAndIncrement(this); WindowFlux<T> g = new WindowFlux<>(groupQueueSupplier.get(), this); window = g; return g; } return null; }
void drainAndCancel() { if (WIP.getAndIncrement(this) == 0) { do { cancelAll(); } while (WIP.decrementAndGet(this) != 0); } }
void drain() { if (WIP.getAndIncrement(this) != 0) { return; } if (outputFused) { drainFused(); } else { drainLoop(); } }
void drain() { if (WIP.getAndIncrement(this) != 0) { return; } if (sourceMode == Fuseable.SYNC) { drainSync(); } else { drainAsync(); } }
void drain() { if (WIP.getAndIncrement(this) != 0) { return; } if (fusionMode == SYNC) { drainSync(); } else { drainAsync(); } }
@Override public void cancel() { if (!cancelled) { cancelled = true; if (WIP.getAndIncrement(this) == 0) { Operators.onDiscardQueueWithClear(scalarQueue, ctx, null); scalarQueue = null; s.cancel(); unsubscribe(); } } }
@Override public void cancel() { if (!cancelled) { cancelled = true; upstream.cancel(); cancelInner(); if (WIP.getAndIncrement(this) == 0) { clear(); } } }
@Override public void cancel() { if (!cancelled) { cancelled = true; s.cancel(); if (WIP.getAndIncrement(this) == 0) { Operators.onDiscardQueueWithClear(queue, actual.currentContext(), null); } } }
@Override public int choosePartition(Message<?> msg, TopicMetadata topicMetadata) { // If the message has a key, it supersedes the round robin routing policy if (msg.hasKey()) { return signSafeMod(hash.makeHash(msg.getKey()), topicMetadata.numPartitions()); } if (isBatchingEnabled) { // if batching is enabled, choose partition on `maxBatchingDelayMs` boundary. long currentMs = clock.millis(); return signSafeMod(currentMs / maxBatchingDelayMs + startPtnIdx, topicMetadata.numPartitions()); } else { return signSafeMod(PARTITION_INDEX_UPDATER.getAndIncrement(this), topicMetadata.numPartitions()); } }