com.lmax.disruptor
Interface WaitStrategy

All Known Implementing Classes:
BlockingWaitStrategy, BusySpinWaitStrategy, SleepingWaitStrategy, YieldingWaitStrategy

public interface WaitStrategy

Strategy employed for making EventProcessors wait on a cursor Sequence.


Method Summary
 void signalAllWhenBlocking()
          Signal those EventProcessors waiting that the cursor has advanced.
 long waitFor(long sequence, Sequence cursor, Sequence[] dependents, SequenceBarrier barrier)
          Wait for the given sequence to be available
 long waitFor(long sequence, Sequence cursor, Sequence[] dependents, SequenceBarrier barrier, long timeout, java.util.concurrent.TimeUnit sourceUnit)
          Wait for the given sequence to be available with a timeout specified.
 

Method Detail

waitFor

long waitFor(long sequence,
             Sequence cursor,
             Sequence[] dependents,
             SequenceBarrier barrier)
             throws AlertException,
                    java.lang.InterruptedException
Wait for the given sequence to be available

Parameters:
sequence - to be waited on.
cursor - on which to wait.
dependents - further back the chain that must advance first
barrier - the processor is waiting 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(long sequence,
             Sequence cursor,
             Sequence[] dependents,
             SequenceBarrier barrier,
             long timeout,
             java.util.concurrent.TimeUnit sourceUnit)
             throws AlertException,
                    java.lang.InterruptedException
Wait for the given sequence to be available with a timeout specified.

Parameters:
sequence - to be waited on.
cursor - on which to wait.
dependents - further back the chain that must advance first
barrier - the processor is waiting on.
timeout - value to abort after.
sourceUnit - 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.

signalAllWhenBlocking

void signalAllWhenBlocking()
Signal those EventProcessors waiting that the cursor has advanced.



Copyright © 2011 LMAX Ltd. All Rights Reserved.