public interface BackOffStrategy
public void pollApi(ApiClient apiClient, BackOffStrategy backOffStrategy) throws BackOffException {
while( apiClient.hasMoreData() ) {
try {
apiClient.pollData();
} catch (RateLimitException rle) {
backOffStrategy.backOff();
}
}
}
| Modifier and Type | Method and Description |
|---|---|
void |
backOff()
Cause the current thread to sleep for an amount of time based on the implemented strategy.
|
void |
reset()
Rests the back off strategy to its original state.
|
void backOff()
throws BackOffException
BackOffException - BackOffExceptionvoid reset()
AbstractBackOffStrategy.backOff()
has never been called.Copyright © 2020 The Apache Software Foundation. All rights reserved.