public class WaitStrategyPark extends Object implements IWaitStrategy
IWaitStrategy.WaitSituation| Constructor and Description |
|---|
WaitStrategyPark() |
WaitStrategyPark(long microsec) |
| Modifier and Type | Method and Description |
|---|---|
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) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateBackPressureWaitStrategypublic WaitStrategyPark()
public WaitStrategyPark(long microsec)
public void prepare(Map<String,Object> conf, IWaitStrategy.WaitSituation waitSituation)
prepare in interface IWaitStrategypublic int idle(int idleCounter)
throws InterruptedException
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(); } idle in interface IWaitStrategyidleCounter - managed by the idle method until resetInterruptedExceptionCopyright © 2021 The Apache Software Foundation. All rights reserved.