MCPcopy
hub / github.com/LMAX-Exchange/disruptor / WaitStrategy

Interface WaitStrategy

src/main/java/com/lmax/disruptor/WaitStrategy.java:22–48  ·  view source on GitHub ↗

Strategy employed for making EventProcessors wait on a cursor Sequence.

Source from the content-addressed store, hash-verified

20 * Strategy employed for making {@link EventProcessor}s wait on a cursor {@link Sequence}.
21 */
22public interface WaitStrategy
23{
24 /**
25 * Wait for the given sequence to be available. It is possible for this method to return a value
26 * less than the sequence number supplied depending on the implementation of the WaitStrategy. A common
27 * use for this is to signal a timeout. Any EventProcessor that is using a WaitStrategy to get notifications
28 * about message becoming available should remember to handle this case. The {@link BatchEventProcessor} explicitly
29 * handles this case and will signal a timeout if required.
30 *
31 * @param sequence to be waited on.
32 * @param cursor the main sequence from ringbuffer. Wait/notify strategies will
33 * need this as it's the only sequence that is also notified upon update.
34 * @param dependentSequence on which to wait.
35 * @param barrier the processor is waiting on.
36 * @return the sequence that is available which may be greater than the requested sequence.
37 * @throws AlertException if the status of the Disruptor has changed.
38 * @throws InterruptedException if the thread is interrupted.
39 * @throws TimeoutException if a timeout occurs before waiting completes (not used by some strategies)
40 */
41 long waitFor(long sequence, Sequence cursor, Sequence dependentSequence, SequenceBarrier barrier)
42 throws AlertException, InterruptedException, TimeoutException;
43
44 /**
45 * Implementations should signal the waiting {@link EventProcessor}s that the cursor has advanced.
46 */
47 void signalAllWhenBlocking();
48}

Callers 15

runMethod · 0.65
runMethod · 0.65
runMethod · 0.65
shouldClaimAndGetMethod · 0.65
shouldWrapMethod · 0.65
runMethod · 0.65
waitForMethod · 0.65
publishMethod · 0.65
publishMethod · 0.65
runMethod · 0.65
publishMethod · 0.65

Implementers 9

DummyWaitStrategysrc/test/java/com/lmax/disruptor/suppo
LiteBlockingWaitStrategysrc/main/java/com/lmax/disruptor/LiteB
BusySpinWaitStrategysrc/main/java/com/lmax/disruptor/BusyS
TimeoutBlockingWaitStrategysrc/main/java/com/lmax/disruptor/Timeo
PhasedBackoffWaitStrategysrc/main/java/com/lmax/disruptor/Phase
LiteTimeoutBlockingWaitStrategysrc/main/java/com/lmax/disruptor/LiteT
BlockingWaitStrategysrc/main/java/com/lmax/disruptor/Block
SleepingWaitStrategysrc/main/java/com/lmax/disruptor/Sleep
YieldingWaitStrategysrc/main/java/com/lmax/disruptor/Yield

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…