Package com.github.twitch4j.util
Interface IBackoffStrategy
- All Known Implementing Classes:
ExponentialBackoffStrategy
public interface IBackoffStrategy
-
Method Summary
Modifier and TypeMethodDescriptionlong
get()
Increments the failure count and computes the appropriate exponential backoff.int
Returns the current failure countvoid
reset()
Resets the failure count for exponential backoff calculations.default boolean
sleep()
Sleeps for the delay suggested byget()
.
-
Method Details
-
sleep
default boolean sleep()Sleeps for the delay suggested byget()
.- Returns:
- whether the sleep was successful (could be false if maximum attempts have been hit, for example).
-
get
long get()Increments the failure count and computes the appropriate exponential backoff.- Returns:
- the amount of milliseconds to delay before retrying.
-
reset
void reset()Resets the failure count for exponential backoff calculations. -
getFailures
int getFailures()Returns the current failure count- Returns:
- failure count
-