Package org.apache.storm.policy

## Interface IWaitStrategy

- All Known Implementing Classes:
    `WaitStrategyPark`, `WaitStrategyProgressive`

      public interface IWaitStrategy

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static class` | `IWaitStrategy.WaitSituation` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static IWaitStrategy` | `createBackPressureWaitStrategy​(Map<String,​Object> topologyConf)` |
    `int` | `idle​(int idleCounter)` | Implementations of this method should be thread-safe (preferably no side-effects and lock-free).
    `void` | `prepare​(Map<String,​Object> conf, IWaitStrategy.WaitSituation waitSituation)` |

- - ### Method Detail

    - #### createBackPressureWaitStrategy

          static IWaitStrategy createBackPressureWaitStrategy​(Map<String,​Object> topologyConf)

    - #### prepare

          void prepare​(Map<String,​Object> conf,
                       IWaitStrategy.WaitSituation waitSituation)

    - #### idle

          int idle​(int idleCounter)
            throws InterruptedException

      Implementations of this method should be thread-safe (preferably no side-effects and lock-free).

      Supports static or dynamic backoff. Dynamic backoff relies on idleCounter to estimate how long caller has been idling.

            int idleCounter = 0;
            int consumeCount = consumeFromQ();
            while (consumeCount==0) {
               idleCounter = strategy.idle(idleCounter);
               consumeCount = consumeFromQ();
            }

      Parameters:
        `idleCounter` - managed by the idle method until reset
      Returns:
        new counter value to be used on subsequent idle cycle
      Throws:
        `InterruptedException`