com.lmax.disruptor
Class SequenceGroup

java.lang.Object
  extended by com.lmax.disruptor.Sequence
      extended by com.lmax.disruptor.SequenceGroup

public final class SequenceGroup
extends Sequence

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).


Constructor Summary
SequenceGroup()
          Default Constructor
 
Method Summary
 void add(Sequence sequence)
          Add a Sequence into this aggregate.
 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 Sequences 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, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SequenceGroup

public SequenceGroup()
Default Constructor

Method Detail

get

public long get()
Get the minimum sequence value for the group.

Overrides:
get in class Sequence
Returns:
the minimum sequence value for the group.

set

public void set(long value)
Set all Sequences in the group to a given value.

Overrides:
set in class Sequence
Parameters:
value - to set the group of sequences to.

add

public void add(Sequence sequence)
Add a Sequence into this aggregate.

Parameters:
sequence - to be added to the aggregate.

remove

public boolean remove(Sequence sequence)
Remove the first occurrence of the Sequence 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.


Copyright © 2011 LMAX Ltd. All Rights Reserved.