com.lmax.disruptor
Class ClaimStrategy.SingleThreadedStrategy

java.lang.Object
  extended by com.lmax.disruptor.ClaimStrategy.SingleThreadedStrategy
All Implemented Interfaces:
ClaimStrategy
Enclosing interface:
ClaimStrategy

public static final class ClaimStrategy.SingleThreadedStrategy
extends java.lang.Object
implements ClaimStrategy

Optimised strategy can be used when there is a single producer thread claiming AbstractEntrys.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.lmax.disruptor.ClaimStrategy
ClaimStrategy.MultiThreadedStrategy, ClaimStrategy.Option, ClaimStrategy.SingleThreadedStrategy
 
Constructor Summary
ClaimStrategy.SingleThreadedStrategy()
           
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClaimStrategy.SingleThreadedStrategy

public ClaimStrategy.SingleThreadedStrategy()
Method Detail

incrementAndGet

public long incrementAndGet()
Description copied from interface: ClaimStrategy
Claim the next sequence index in the RingBuffer and increment.

Specified by:
incrementAndGet in interface ClaimStrategy
Returns:
the AbstractEntry index to be used for the producer.

incrementAndGet

public long incrementAndGet(int delta)
Description copied from interface: ClaimStrategy
Increment by a delta and get the result.

Specified by:
incrementAndGet in interface ClaimStrategy
Parameters:
delta - to increment by.
Returns:
the result after incrementing.

setSequence

public void setSequence(long sequence)
Description copied from interface: ClaimStrategy
Set the current sequence value for claiming AbstractEntry in the RingBuffer

Specified by:
setSequence in interface ClaimStrategy
Parameters:
sequence - to be set as the current value.


Copyright © 2011 LMAX Ltd. All Rights Reserved.