Class WaitStrategyPark

    • Constructor Detail

      • WaitStrategyPark

        public WaitStrategyPark()
      • WaitStrategyPark

        public WaitStrategyPark​(long microsec)
    • Method Detail

      • idle

        public int idle​(int idleCounter)
                 throws InterruptedException
        Description copied from interface: IWaitStrategy
        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();
          }
         
         
        Specified by:
        idle in interface IWaitStrategy
        Parameters:
        idleCounter - managed by the idle method until reset
        Returns:
        new counter value to be used on subsequent idle cycle
        Throws:
        InterruptedException