org.modeshape.common.collection.ring

## Interface WaitStrategy

- All Known Implementing Classes:
    BlockingWaitStrategy

      public interface WaitStrategy

  Strategy that encapsulates how to wait for a `Pointer` to make the supplied position available.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `signalAllWhenBlocking()` Signal all components that want to be notified that the pointer has advanced.
    `long` | `waitFor(long position, Pointer pointer, Pointer dependentPointer, PointerBarrier barrier)` Wait for the given position to be available.

- - ### Method Detail

    - #### waitFor

          long waitFor(long position,
                     Pointer pointer,
                     Pointer dependentPointer,
                     PointerBarrier barrier)
                       throws InterruptedException,
                              TimeoutException

      Wait for the given position to be available. It is possible for this method to return a value less than the supplied position supplied on the implementation of the `WaitStrategy`. A common use for this is to signal a timeout.
      Parameters:
        `position` - the desired position
        `pointer` - the main pointer from ringbuffer. Wait/notify strategies will need this as it's the only sequence that is also notified upon update.
        `dependentPointer` - on which to wait.
        `barrier` - the processor is waiting on.
      Returns:
        the position that is available, and that may be greater than the requested position.
      Throws:
        `InterruptedException` - if the thread is interrupted.
        `TimeoutException` - if this blocking method times out

    - #### signalAllWhenBlocking

          void signalAllWhenBlocking()

      Signal all components that want to be notified that the pointer has advanced.

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.