Package org.apache.storm.policy
Class WaitStrategyPark
- java.lang.Object
-
- org.apache.storm.policy.WaitStrategyPark
-
- All Implemented Interfaces:
IWaitStrategy
public class WaitStrategyPark extends Object implements IWaitStrategy
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.storm.policy.IWaitStrategy
IWaitStrategy.WaitSituation
-
-
Constructor Summary
Constructors Constructor Description WaitStrategyPark()WaitStrategyPark(long microsec)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intidle(int idleCounter)Implementations of this method should be thread-safe (preferably no side-effects and lock-free).voidprepare(Map<String,Object> conf, IWaitStrategy.WaitSituation waitSituation)
-
-
-
Method Detail
-
prepare
public void prepare(Map<String,Object> conf, IWaitStrategy.WaitSituation waitSituation)
- Specified by:
preparein interfaceIWaitStrategy
-
idle
public int idle(int idleCounter) throws InterruptedExceptionDescription copied from interface:IWaitStrategyImplementations 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:
idlein interfaceIWaitStrategy- Parameters:
idleCounter- managed by the idle method until reset- Returns:
- new counter value to be used on subsequent idle cycle
- Throws:
InterruptedException
-
-