|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.lmax.disruptor.Sequencer
public class Sequencer
Coordinator for claiming sequences for access to a data structure while tracking dependent Sequences
| Field Summary | |
|---|---|
static long |
INITIAL_CURSOR_VALUE
Set to -1 as sequence starting point |
| Constructor Summary | |
|---|---|
Sequencer(ClaimStrategy claimStrategy,
WaitStrategy waitStrategy)
Construct a Sequencer with the selected strategies. |
|
| Method Summary | |
|---|---|
long |
claim(long sequence)
Claim a specific sequence when only one publisher is involved. |
void |
forcePublish(long sequence)
Force the publication of a cursor sequence. |
int |
getBufferSize()
The capacity of the data structure to hold entries. |
long |
getCursor()
Get the value of the cursor indicating the published sequence. |
boolean |
hasAvailableCapacity(int availableCapacity)
Has the buffer got capacity to allocate another sequence. |
SequenceBarrier |
newBarrier(Sequence... sequencesToTrack)
Create a SequenceBarrier that gates on the the cursor and a list of Sequences |
BatchDescriptor |
newBatchDescriptor(int size)
Create a new BatchDescriptor that is the minimum of the requested size
and the buffer size. |
long |
next()
Claim the next event in sequence for publishing. |
BatchDescriptor |
next(BatchDescriptor batchDescriptor)
Claim the next batch of sequence numbers for publishing. |
void |
publish(BatchDescriptor batchDescriptor)
Publish the batch of events in sequence. |
void |
publish(long sequence)
Publish an event and make it visible to EventProcessors |
long |
remainingCapacity()
|
void |
setGatingSequences(Sequence... sequences)
Set the sequences that will gate publishers to prevent the buffer wrapping. |
long |
tryNext(int requiredCapacity)
Attempt to claim the next event in sequence for publishing. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long INITIAL_CURSOR_VALUE
| Constructor Detail |
|---|
public Sequencer(ClaimStrategy claimStrategy,
WaitStrategy waitStrategy)
claimStrategy - for those claiming sequences.waitStrategy - for those waiting on sequences.| Method Detail |
|---|
public void setGatingSequences(Sequence... sequences)
sequences - to be to be gated on.public SequenceBarrier newBarrier(Sequence... sequencesToTrack)
SequenceBarrier that gates on the the cursor and a list of Sequences
sequencesToTrack - this barrier will track
public BatchDescriptor newBatchDescriptor(int size)
BatchDescriptor that is the minimum of the requested size
and the buffer size.
size - for the batch
BatchDescriptorpublic int getBufferSize()
public long getCursor()
public boolean hasAvailableCapacity(int availableCapacity)
availableCapacity - in the buffer
public long next()
public long tryNext(int requiredCapacity)
throws InsufficientCapacityException
requiredCapacity slots
available.
requiredCapacity - as slots in the data structure
InsufficientCapacityException - when the requiredCapacity is not availablepublic BatchDescriptor next(BatchDescriptor batchDescriptor)
batchDescriptor - to be updated for the batch range.
public long claim(long sequence)
sequence - to be claimed.
public void publish(long sequence)
EventProcessors
sequence - to be publishedpublic void publish(BatchDescriptor batchDescriptor)
batchDescriptor - to be published.public void forcePublish(long sequence)
sequence - which is to be forced for publication.public long remainingCapacity()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||