public final class SequenceGroup extends Sequence
Sequence
group that can dynamically have Sequence
s 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)
.
Constructor and Description |
---|
SequenceGroup()
Default Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(Sequence sequence)
Add a
Sequence 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 the
Sequence from this aggregate. |
void |
set(long value)
Set all
Sequence s in the group to a given value. |
int |
size()
Get the size of the group.
|
addAndGet, compareAndSet, incrementAndGet, setVolatile, toString
public long get()
public void set(long value)
Sequence
s in the group to a given value.public void add(Sequence sequence)
Sequence
into this aggregate. This should only be used during
initialisation. Use addWhileRunning(Cursored, Sequence)
sequence
- to be added to the aggregate.addWhileRunning(Cursored, Sequence)
public boolean remove(Sequence sequence)
Sequence
from this aggregate.sequence
- to be removed from this aggregate.public int size()
public void addWhileRunning(Cursored cursored, Sequence sequence)
cursored
- The data structure that the owner of this sequence group will
be pulling it's events from.sequence
- The sequence to add.Copyright © 2011 - 2013 LMAX Ltd. All Rights Reserved.