Package com.lmax.disruptor
Class ProcessingSequenceBarrier
java.lang.Object
com.lmax.disruptor.ProcessingSequenceBarrier
- All Implemented Interfaces:
SequenceBarrier
SequenceBarrier
handed out for gating EventProcessor
s on a cursor sequence and optional dependent EventProcessor
(s),
using the given WaitStrategy.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private final Sequence
private final Sequence
private final Sequencer
private final WaitStrategy
-
Constructor Summary
ConstructorsConstructorDescriptionProcessingSequenceBarrier
(Sequencer sequencer, WaitStrategy waitStrategy, Sequence cursorSequence, Sequence[] dependentSequences) -
Method Summary
Modifier and TypeMethodDescriptionvoid
alert()
Alert theEventProcessor
s of a status change and stay in this status until cleared.void
Check if an alert has been raised and throw anAlertException
if it has.void
Clear the current alert status.long
Get the current cursor value that can be read.boolean
The current alert status for the barrier.long
waitFor
(long sequence) Wait for the given sequence to be available for consumption.
-
Field Details
-
waitStrategy
-
dependentSequence
-
alerted
private volatile boolean alerted -
cursorSequence
-
sequencer
-
-
Constructor Details
-
ProcessingSequenceBarrier
ProcessingSequenceBarrier(Sequencer sequencer, WaitStrategy waitStrategy, Sequence cursorSequence, Sequence[] dependentSequences)
-
-
Method Details
-
waitFor
Description copied from interface:SequenceBarrier
Wait for the given sequence to be available for consumption.- Specified by:
waitFor
in interfaceSequenceBarrier
- Parameters:
sequence
- to wait for- Returns:
- the sequence up to which is available
- Throws:
AlertException
- if a status change has occurred for the DisruptorInterruptedException
- if the thread needs awaking on a condition variable.TimeoutException
- if a timeout occurs while waiting for the supplied sequence.
-
getCursor
public long getCursor()Description copied from interface:SequenceBarrier
Get the current cursor value that can be read.- Specified by:
getCursor
in interfaceSequenceBarrier
- Returns:
- value of the cursor for entries that have been published.
-
isAlerted
public boolean isAlerted()Description copied from interface:SequenceBarrier
The current alert status for the barrier.- Specified by:
isAlerted
in interfaceSequenceBarrier
- Returns:
- true if in alert otherwise false.
-
alert
public void alert()Description copied from interface:SequenceBarrier
Alert theEventProcessor
s of a status change and stay in this status until cleared.- Specified by:
alert
in interfaceSequenceBarrier
-
clearAlert
public void clearAlert()Description copied from interface:SequenceBarrier
Clear the current alert status.- Specified by:
clearAlert
in interfaceSequenceBarrier
-
checkAlert
Description copied from interface:SequenceBarrier
Check if an alert has been raised and throw anAlertException
if it has.- Specified by:
checkAlert
in interfaceSequenceBarrier
- Throws:
AlertException
- if alert has been raised.
-