org.modeshape.common.collection.ring

## Class BlockingWaitStrategy

- java.lang.Object
- - org.modeshape.common.collection.ring.BlockingWaitStrategy

- All Implemented Interfaces:
    WaitStrategy

      public class BlockingWaitStrategy
      extends Object
      implements WaitStrategy

  A `WaitStrategy` that blocks the current thread until an entry is available for consumption. This implementation uses Java locks and `conditions`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BlockingWaitStrategy()`

  - ### 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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BlockingWaitStrategy

          public BlockingWaitStrategy()

  - ### Method Detail

    - #### waitFor

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

      Description copied from interface: `WaitStrategy`
      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.
      Specified by:
        `waitFor` in interface `WaitStrategy`
      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.

    - #### signalAllWhenBlocking

          public void signalAllWhenBlocking()

      Description copied from interface: `WaitStrategy`
      Signal all components that want to be notified that the pointer has advanced.
      Specified by:
        `signalAllWhenBlocking` in interface `WaitStrategy`

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