public interface Sequencer extends Cursored
Sequence
sModifier and Type | Field and Description |
---|---|
static long |
INITIAL_CURSOR_VALUE
Set to -1 as sequence starting point
|
Modifier and Type | Method and Description |
---|---|
void |
addGatingSequences(Sequence... gatingSequences)
Add the specified gating sequences to this instance of the Disruptor.
|
void |
claim(long sequence)
Claim a specific sequence.
|
void |
ensureAvailable(long sequence)
Ensure a given sequence has been published and the event is now available.
Blocks if the sequence is not available yet.
|
int |
getBufferSize()
The capacity of the data structure to hold entries.
|
long |
getMinimumSequence()
Get the minimum sequence value from all of the gating sequences
added to this ringBuffer.
|
boolean |
hasAvailableCapacity(int requiredCapacity)
Has the buffer got capacity to allocate another sequence.
|
boolean |
isAvailable(long sequence)
Confirms if a sequence is published and the event is available for use; non-blocking.
|
SequenceBarrier |
newBarrier(Sequence... sequencesToTrack)
Create a new SequenceBarrier to be used by an EventProcessor to track which messages
are available to be read from the ring buffer given a list of sequences to track.
|
long |
next()
Claim the next event in sequence for publishing.
|
long |
next(int n)
Claim the next n events in sequence for publishing.
|
void |
publish(long sequence)
Publishes a sequence.
|
void |
publish(long lo,
long hi)
Batch publish sequences.
|
long |
remainingCapacity()
Get the remaining capacity for this sequencer.
|
boolean |
removeGatingSequence(Sequence sequence)
Remove the specified sequence from this sequencer.
|
long |
tryNext()
Attempt to claim the next event in sequence for publishing.
|
long |
tryNext(int n)
Attempt to claim the next n events in sequence for publishing.
|
static final long INITIAL_CURSOR_VALUE
int getBufferSize()
boolean hasAvailableCapacity(int requiredCapacity)
requiredCapacity
- in the bufferlong next()
long next(int n)
int n = 10; long hi = sequencer.next(n); long lo = hi - (n - 1); for (long sequence = lo; sequence <= hi; sequence++) { // Do work. } sequencer.publish(lo, hi);
n
- the number of sequences to claimlong tryNext() throws InsufficientCapacityException
requiredCapacity
slots
available.InsufficientCapacityException
long tryNext(int n) throws InsufficientCapacityException
requiredCapacity
slots
available. Have a look at next()
for a description on how to
use this method.n
- the number of sequences to claimInsufficientCapacityException
long remainingCapacity()
void claim(long sequence)
sequence
- The sequence to initialise too.void publish(long sequence)
sequence
- void publish(long lo, long hi)
lo
- first sequence number to publishhi
- last sequence number to publishboolean isAvailable(long sequence)
sequence
- of the buffer to checkvoid ensureAvailable(long sequence)
sequence
- of the event to wait forvoid addGatingSequences(Sequence... gatingSequences)
gatingSequences
- The sequences to add.boolean removeGatingSequence(Sequence sequence)
sequence
- to be removed.SequenceBarrier newBarrier(Sequence... sequencesToTrack)
sequencesToTrack
- SequenceBarrier
long getMinimumSequence()
Copyright © 2011 - 2013 LMAX Ltd. All Rights Reserved.