final class ProcessingSequenceBarrier extends java.lang.Object implements SequenceBarrier
SequenceBarrier
handed out for gating EventProcessor
s 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
EventProcessor s 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
SequenceBarrier
waitFor
in interface SequenceBarrier
sequence
- to wait forAlertException
- if a status change has occurred for the Disruptorjava.lang.InterruptedException
- if the thread needs awaking on a condition variable.TimeoutException
public long getCursor()
SequenceBarrier
getCursor
in interface SequenceBarrier
public boolean isAlerted()
SequenceBarrier
isAlerted
in interface SequenceBarrier
public void alert()
SequenceBarrier
EventProcessor
s of a status change and stay in this status until cleared.alert
in interface SequenceBarrier
public void clearAlert()
SequenceBarrier
clearAlert
in interface SequenceBarrier
public void checkAlert() throws AlertException
SequenceBarrier
AlertException
if it has.checkAlert
in interface SequenceBarrier
AlertException
- if alert has been raised.