public interface IWaitStrategy
Modifier and Type | Interface and Description |
---|---|
static class |
IWaitStrategy.WaitSituation |
Modifier and Type | Method and 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) |
static IWaitStrategy createBackPressureWaitStrategy(Map<String,Object> topologyConf)
void prepare(Map<String,Object> conf, IWaitStrategy.WaitSituation waitSituation)
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(); }
idleCounter
- managed by the idle method until resetInterruptedException
Copyright © 2020 The Apache Software Foundation. All rights reserved.