com.lmax.disruptor
Interface WaitStrategy

All Known Implementing Classes:
WaitStrategy.BlockingStrategy, WaitStrategy.BusySpinStrategy, WaitStrategy.YieldingStrategy

public interface WaitStrategy

Strategy employed for making Consumers wait on a RingBuffer.


Nested Class Summary
static class WaitStrategy.BlockingStrategy
          Blocking strategy that uses a lock and condition variable for Consumers waiting on a barrier.
static class WaitStrategy.BusySpinStrategy
          Busy Spin strategy that uses a busy spin loop for Consumers waiting on a barrier.
static class WaitStrategy.Option
          Strategy options which are available to those waiting on a RingBuffer
static class WaitStrategy.YieldingStrategy
          Yielding strategy that uses a Thread.yield() for Consumers waiting on a barrier.
 
Method Summary
 void signalAll()
          Signal those waiting that the RingBuffer cursor has advanced.
 long waitFor(Consumer[] consumers, RingBuffer ringBuffer, ConsumerBarrier barrier, long sequence)
          Wait for the given sequence to be available for consumption in a RingBuffer
 long waitFor(Consumer[] consumers, RingBuffer ringBuffer, ConsumerBarrier barrier, long sequence, long timeout, java.util.concurrent.TimeUnit units)
          Wait for the given sequence to be available for consumption in a RingBuffer with a timeout specified.
 

Method Detail

waitFor

long waitFor(Consumer[] consumers,
             RingBuffer ringBuffer,
             ConsumerBarrier barrier,
             long sequence)
             throws AlertException,
                    java.lang.InterruptedException
Wait for the given sequence to be available for consumption in a RingBuffer

Parameters:
consumers - further back the chain that must advance first
ringBuffer - on which to wait.
barrier - the consumer is waiting on.
sequence - to be waited on.
Returns:
the sequence that is available which may be greater than the requested sequence.
Throws:
AlertException - if the status of the Disruptor has changed.
java.lang.InterruptedException - if the thread is interrupted.

waitFor

long waitFor(Consumer[] consumers,
             RingBuffer ringBuffer,
             ConsumerBarrier barrier,
             long sequence,
             long timeout,
             java.util.concurrent.TimeUnit units)
             throws AlertException,
                    java.lang.InterruptedException
Wait for the given sequence to be available for consumption in a RingBuffer with a timeout specified.

Parameters:
consumers - further back the chain that must advance first
ringBuffer - on which to wait.
barrier - the consumer is waiting on.
sequence - to be waited on.
timeout - value to abort after.
units - of the timeout value.
Returns:
the sequence that is available which may be greater than the requested sequence.
Throws:
AlertException - if the status of the Disruptor has changed.
java.lang.InterruptedException - if the thread is interrupted.

signalAll

void signalAll()
Signal those waiting that the RingBuffer cursor has advanced.



Copyright © 2011 LMAX Ltd. All Rights Reserved.