EventSequencer<T>
, Sequencer
AbstractSequencer
, MultiProducerSequencer
, RingBuffer
, SingleProducerSequencer
public interface Sequenced
Modifier and Type | Method | Description |
---|---|---|
int |
getBufferSize() |
The capacity of the data structure to hold entries.
|
boolean |
hasAvailableCapacity(int requiredCapacity) |
Has the buffer got capacity to allocate another sequence.
|
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.
|
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.
|
int getBufferSize()
boolean hasAvailableCapacity(int requiredCapacity)
requiredCapacity
- in the bufferlong remainingCapacity()
long 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
void publish(long sequence)
sequence
- void publish(long lo, long hi)
lo
- first sequence number to publishhi
- last sequence number to publishCopyright © 2019. All rights reserved.