Class SequenceGroup
java.lang.Object
com.lmax.disruptor.LhsPadding
com.lmax.disruptor.Value
com.lmax.disruptor.RhsPadding
com.lmax.disruptor.Sequence
com.lmax.disruptor.SequenceGroup
A
Sequence group that can dynamically have Sequences added and removed while being
thread safe.
The get() and set(long) methods are lock free and can be
concurrently be called with the add(Sequence) and remove(Sequence).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final AtomicReferenceFieldUpdater<SequenceGroup, Sequence[]> private Sequence[]Fields inherited from class Sequence
INITIAL_VALUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd aSequenceinto this aggregate.voidaddWhileRunning(Cursored cursored, Sequence sequence) Adds a sequence to the sequence group after threads have started to publish to the Disruptor.longget()Get the minimum sequence value for the group.booleanRemove the first occurrence of theSequencefrom this aggregate.voidset(long value) Set allSequences in the group to a given value.intsize()Get the size of the group.Methods inherited from class Sequence
addAndGet, compareAndSet, incrementAndGet, setVolatile, toString
-
Field Details
-
SEQUENCE_UPDATER
-
sequences
-
-
Constructor Details
-
SequenceGroup
public SequenceGroup()Default Constructor
-
-
Method Details
-
get
-
set
-
add
Add aSequenceinto this aggregate. This should only be used during initialisation. UseaddWhileRunning(Cursored, Sequence)- Parameters:
sequence- to be added to the aggregate.- See Also:
-
remove
-
size
public int size()Get the size of the group.- Returns:
- the size of the group.
-
addWhileRunning
Adds a sequence to the sequence group after threads have started to publish to the Disruptor. It will set the sequences to cursor value of the ringBuffer just after adding them. This should prevent any nasty rewind/wrapping effects.- Parameters:
cursored- The data structure that the owner of this sequence group will be pulling it's events from.sequence- The sequence to add.
-