com.lmax.disruptor
Interface ConsumerBarrier<T extends AbstractEntry>

Type Parameters:
T - AbstractEntry implementation stored in the RingBuffer

public interface ConsumerBarrier<T extends AbstractEntry>

Coordination barrier for tracking the cursor for producers and sequence of dependent Consumers for a RingBuffer


Method Summary
 void alert()
          Alert the consumers of a status change and stay in this status until cleared.
 void clearAlert()
          Clear the current alert status.
 long getCursor()
          Delegate a call to the RingBuffer.getCursor()
 T getEntry(long sequence)
          Get the AbstractEntry for a given sequence from the underlying RingBuffer.
 boolean isAlerted()
          The current alert status for the barrier.
 long waitFor(long sequence)
          Wait for the given sequence to be available for consumption.
 long waitFor(long sequence, long timeout, java.util.concurrent.TimeUnit units)
          Wait for the given sequence to be available for consumption with a time out.
 

Method Detail

getEntry

T getEntry(long sequence)
Get the AbstractEntry for a given sequence from the underlying RingBuffer.

Parameters:
sequence - of the AbstractEntry to get.
Returns:
the AbstractEntry for the sequence.

waitFor

long waitFor(long sequence)
             throws AlertException,
                    java.lang.InterruptedException
Wait for the given sequence to be available for consumption.

Parameters:
sequence - to wait for
Returns:
the sequence up to which is available
Throws:
AlertException - if a status change has occurred for the Disruptor
java.lang.InterruptedException - if the thread needs awaking on a condition variable.

waitFor

long waitFor(long sequence,
             long timeout,
             java.util.concurrent.TimeUnit units)
             throws AlertException,
                    java.lang.InterruptedException
Wait for the given sequence to be available for consumption with a time out.

Parameters:
sequence - to wait for
timeout - value
units - for the timeout value
Returns:
the sequence up to which is available
Throws:
AlertException - if a status change has occurred for the Disruptor
java.lang.InterruptedException - if the thread needs awaking on a condition variable.

getCursor

long getCursor()
Delegate a call to the RingBuffer.getCursor()

Returns:
value of the cursor for entries that have been published.

isAlerted

boolean isAlerted()
The current alert status for the barrier.

Returns:
true if in alert otherwise false.

alert

void alert()
Alert the consumers of a status change and stay in this status until cleared.


clearAlert

void clearAlert()
Clear the current alert status.



Copyright © 2011 LMAX Ltd. All Rights Reserved.