Package com.lmax.disruptor
Class SequenceGroup
- java.lang.Object
-
- com.lmax.disruptor.Sequence
-
- com.lmax.disruptor.SequenceGroup
-
public final class SequenceGroup extends Sequence
ASequence
group that can dynamically haveSequence
s added and removed while being thread safe.The
get()
andset(long)
methods are lock free and can be concurrently be called with theadd(Sequence)
andremove(Sequence)
.
-
-
Field Summary
Fields Modifier and Type Field Description protected long
p1
protected long
p10
protected long
p11
protected long
p12
protected long
p13
protected long
p14
protected long
p15
protected long
p2
protected long
p3
protected long
p4
protected long
p5
protected long
p6
protected long
p7
protected long
p9
protected long
value
-
Constructor Summary
Constructors Constructor Description SequenceGroup()
Default Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Sequence sequence)
Add aSequence
into this aggregate.void
addWhileRunning(Cursored cursored, Sequence sequence)
Adds a sequence to the sequence group after threads have started to publish to the Disruptor.long
get()
Get the minimum sequence value for the group.boolean
remove(Sequence sequence)
Remove the first occurrence of theSequence
from this aggregate.void
set(long value)
Set allSequence
s in the group to a given value.int
size()
Get the size of the group.-
Methods inherited from class com.lmax.disruptor.Sequence
addAndGet, compareAndSet, incrementAndGet, setVolatile, toString
-
-
-
-
Field Detail
-
p9
protected long p9
-
p10
protected long p10
-
p11
protected long p11
-
p12
protected long p12
-
p13
protected long p13
-
p14
protected long p14
-
p15
protected long p15
-
value
protected volatile long value
-
p1
protected long p1
-
p2
protected long p2
-
p3
protected long p3
-
p4
protected long p4
-
p5
protected long p5
-
p6
protected long p6
-
p7
protected long p7
-
-
Method Detail
-
get
public long get()
Get the minimum sequence value for the group.
-
set
public void set(long value)
Set allSequence
s in the group to a given value.
-
add
public void add(Sequence sequence)
Add aSequence
into this aggregate. This should only be used during initialisation. UseaddWhileRunning(Cursored, Sequence)
- Parameters:
sequence
- to be added to the aggregate.- See Also:
addWhileRunning(Cursored, Sequence)
-
remove
public boolean remove(Sequence sequence)
Remove the first occurrence of theSequence
from this aggregate.- Parameters:
sequence
- to be removed from this aggregate.- Returns:
- true if the sequence was removed otherwise false.
-
size
public int size()
Get the size of the group.- Returns:
- the size of the group.
-
addWhileRunning
public void addWhileRunning(Cursored cursored, Sequence sequence)
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.
-
-