final class ProcessingSequenceBarrier extends java.lang.Object implements SequenceBarrier
SequenceBarrier handed out for gating EventProcessors on a cursor sequence and optional dependent EventProcessor(s),
using the given WaitStrategy.| Modifier and Type | Field and Description |
|---|---|
private boolean |
alerted |
private Sequence |
cursorSequence |
private Sequence |
dependentSequence |
private Sequencer |
sequencer |
private WaitStrategy |
waitStrategy |
| Constructor and Description |
|---|
ProcessingSequenceBarrier(Sequencer sequencer,
WaitStrategy waitStrategy,
Sequence cursorSequence,
Sequence[] dependentSequences) |
| Modifier and Type | Method and Description |
|---|---|
void |
alert()
Alert the
EventProcessors of a status change and stay in this status until cleared. |
void |
checkAlert()
Check if an alert has been raised and throw an
AlertException if it has. |
void |
clearAlert()
Clear the current alert status.
|
long |
getCursor()
Get the current cursor value that can be read.
|
boolean |
isAlerted()
The current alert status for the barrier.
|
long |
waitFor(long sequence)
Wait for the given sequence to be available for consumption.
|
private final WaitStrategy waitStrategy
private final Sequence dependentSequence
private volatile boolean alerted
private final Sequence cursorSequence
private final Sequencer sequencer
public ProcessingSequenceBarrier(Sequencer sequencer, WaitStrategy waitStrategy, Sequence cursorSequence, Sequence[] dependentSequences)
public long waitFor(long sequence)
throws AlertException,
java.lang.InterruptedException,
TimeoutException
SequenceBarrierwaitFor in interface SequenceBarriersequence - to wait forAlertException - if a status change has occurred for the Disruptorjava.lang.InterruptedException - if the thread needs awaking on a condition variable.TimeoutExceptionpublic long getCursor()
SequenceBarriergetCursor in interface SequenceBarrierpublic boolean isAlerted()
SequenceBarrierisAlerted in interface SequenceBarrierpublic void alert()
SequenceBarrierEventProcessors of a status change and stay in this status until cleared.alert in interface SequenceBarrierpublic void clearAlert()
SequenceBarrierclearAlert in interface SequenceBarrierpublic void checkAlert()
throws AlertException
SequenceBarrierAlertException if it has.checkAlert in interface SequenceBarrierAlertException - if alert has been raised.