public final class RingBufferReader
extends java.lang.Object
implements java.lang.Runnable, java.util.function.LongSupplier
Modifier and Type | Method and Description |
---|---|
void |
alert()
Alert the ringbuffer consumers of a status change and stay in this status until cleared.
|
void |
checkAlert()
Check if an alert has been raised and throw an if it has.
|
void |
clearAlert()
Clear the current alert status.
|
long |
getAsLong() |
long |
getCursor()
Get the current cursor value that can be read.
|
boolean |
isAlerted()
The current alert status for the barrier.
|
void |
run() |
void |
signal()
Signal the ringbuffer consumers.
|
long |
waitFor(long sequence)
Wait for the given sequence to be available for consumption.
|
long |
waitFor(long sequence,
java.lang.Runnable consumer)
Wait for the given sequence to be available for consumption.
|
public long waitFor(long sequence) throws reactor.util.concurrent.RingBuffer.AlertException, java.lang.InterruptedException
sequence
- to wait forRingBuffer.AlertException
- if a status change has occurred for the Disruptorjava.lang.InterruptedException
- if the thread needs awaking on a condition variable.public long waitFor(long sequence, java.lang.Runnable consumer) throws reactor.util.concurrent.RingBuffer.AlertException, java.lang.InterruptedException
consumer
- a spin observer to invoke when nothing is available to readsequence
- to wait forRingBuffer.AlertException
- if a status change has occurred for the Disruptorjava.lang.InterruptedException
- if the thread needs awaking on a condition variable.public long getCursor()
public boolean isAlerted()
public void alert()
public void signal()
public void clearAlert()
public void checkAlert() throws reactor.util.concurrent.RingBuffer.AlertException
RingBuffer.AlertException
- if alert has been raised.public long getAsLong()
getAsLong
in interface java.util.function.LongSupplier
public void run()
run
in interface java.lang.Runnable