@Override public void run() { if (!running.get() || processor.isTerminated()) { WaitStrategy.alert(); } } };
@Override public void run() { if (!alive()) { WaitStrategy.alert(); } }
void readNextEvent(final boolean unbounded) { //pause until request while ((!unbounded && getAndSub(pendingRequest, 1L) == 0L)) { if (!isRunning()) { WaitStrategy.alert(); } //Todo Use WaitStrategy? LockSupport.parkNanos(1L); } }
/** * Block the calling thread for the specified time, waiting for the completion of this {@code MonoProcessor}. If the * {@link MonoProcessor} is completed with an error a RuntimeException that wraps the error is thrown. * * @param timeout the timeout value as a {@link Duration} * * @return the value of this {@code MonoProcessor} or {@code null} if the timeout is reached and the {@code MonoProcessor} has * not completed */ @Override @Nullable public O block(Duration timeout) { long delay = System.nanoTime() + timeout.toNanos(); Runnable spinObserver = () -> { if (delay < System.nanoTime()) { WaitStrategy.alert(); } }; return block(spinObserver); }
@Override public void run() { if (!alive() && SUBSCRIBER_COUNT.get(TopicProcessor.this) == 0) { WaitStrategy.alert(); } }
/** * Wait for the given sequence to be available for consumption. * * @param consumer a spin observer to invoke when nothing is available to read * @param sequence to wait for * @return the sequence up to which is available * @throws InterruptedException if the thread needs awaking on a condition variable. */ long waitFor(final long sequence, Runnable consumer) throws InterruptedException { if (alerted) { WaitStrategy.alert(); } long availableSequence = waitStrategy.waitFor(sequence, cursorSequence, consumer); if (availableSequence < sequence) { return availableSequence; } return sequenceProducer.getHighestPublishedSequence(sequence, availableSequence); } /**
WaitStrategy.alert();
@Override public void run() { if (barrier.isAlerted() || !isRunning() || replay(pendingRequest.getAsLong() == Long.MAX_VALUE)) { WaitStrategy.alert(); } } };
WaitStrategy.alert();
while ((!unbounded && pendingRequest.getAsLong() == 0L)) { if (!isRunning()) { WaitStrategy.alert();
@Override public void run() { if (!alive()) { WaitStrategy.alert(); } }
@Override public void run() { if (!running.get() || processor.isTerminated()) { WaitStrategy.alert(); } } };
void readNextEvent(final boolean unbounded) { //pause until request while ((!unbounded && getAndSub(pendingRequest, 1L) == 0L)) { if (!isRunning()) { WaitStrategy.alert(); } //Todo Use WaitStrategy? LockSupport.parkNanos(1L); } }
/** * Block the calling thread for the specified time, waiting for the completion of this {@code MonoProcessor}. If the * {@link MonoProcessor} is completed with an error a RuntimeException that wraps the error is thrown. * * @param timeout the timeout value as a {@link Duration} * * @return the value of this {@code MonoProcessor} or {@code null} if the timeout is reached and the {@code MonoProcessor} has * not completed */ @Override @Nullable public O block(Duration timeout) { long delay = System.nanoTime() + timeout.toNanos(); Runnable spinObserver = () -> { if (delay < System.nanoTime()) { WaitStrategy.alert(); } }; return block(spinObserver); }
@Override public void run() { if (!alive() && SUBSCRIBER_COUNT.get(TopicProcessor.this) == 0) { WaitStrategy.alert(); } }
/** * Wait for the given sequence to be available for consumption. * * @param consumer a spin observer to invoke when nothing is available to read * @param sequence to wait for * @return the sequence up to which is available * @throws InterruptedException if the thread needs awaking on a condition variable. */ long waitFor(final long sequence, Runnable consumer) throws InterruptedException { if (alerted) { WaitStrategy.alert(); } long availableSequence = waitStrategy.waitFor(sequence, cursorSequence, consumer); if (availableSequence < sequence) { return availableSequence; } return sequenceProducer.getHighestPublishedSequence(sequence, availableSequence); } /**
WaitStrategy.alert();
@Override public void run() { if (barrier.isAlerted() || !isRunning() || replay(pendingRequest.getAsLong() == Long.MAX_VALUE)) { WaitStrategy.alert(); } } };
WaitStrategy.alert();
while ((!unbounded && pendingRequest.getAsLong() == 0L)) { if (!isRunning()) { WaitStrategy.alert();