com.lmax.disruptor
Interface ClaimStrategy

All Known Implementing Classes:
ClaimStrategy.MultiThreadedStrategy, ClaimStrategy.SingleThreadedStrategy

public interface ClaimStrategy

Strategies employed for claiming the sequence of AbstractEntrys in the RingBuffer by producers. The AbstractEntry index is a the sequence value mod the RingBuffer capacity.


Nested Class Summary
static class ClaimStrategy.MultiThreadedStrategy
          Strategy to be used when there are multiple producer threads claiming AbstractEntrys.
static class ClaimStrategy.Option
          Indicates the threading policy to be applied for claiming AbstractEntrys by producers to the RingBuffer
static class ClaimStrategy.SingleThreadedStrategy
          Optimised strategy can be used when there is a single producer thread claiming AbstractEntrys.
 
Method Summary
 long incrementAndGet()
          Claim the next sequence index in the RingBuffer and increment.
 long incrementAndGet(int delta)
          Increment by a delta and get the result.
 void setSequence(long sequence)
          Set the current sequence value for claiming AbstractEntry in the RingBuffer
 

Method Detail

incrementAndGet

long incrementAndGet()
Claim the next sequence index in the RingBuffer and increment.

Returns:
the AbstractEntry index to be used for the producer.

incrementAndGet

long incrementAndGet(int delta)
Increment by a delta and get the result.

Parameters:
delta - to increment by.
Returns:
the result after incrementing.

setSequence

void setSequence(long sequence)
Set the current sequence value for claiming AbstractEntry in the RingBuffer

Parameters:
sequence - to be set as the current value.


Copyright © 2011 LMAX Ltd. All Rights Reserved.