com.twitter.common.util
Interface BackoffStrategy

All Known Implementing Classes:
TruncatedBinaryBackoff

public interface BackoffStrategy

Encapsulates a strategy for backing off from an operation that repeatedly fails.


Method Summary
 long calculateBackoffMs(long lastBackoffMs)
          Calculates the amount of time to backoff from an operation.
 boolean shouldContinue()
          Returns whether to continue backing off.
 

Method Detail

calculateBackoffMs

long calculateBackoffMs(long lastBackoffMs)
Calculates the amount of time to backoff from an operation.

Parameters:
lastBackoffMs - the last used backoff in milliseconds where 0 signifies no backoff has been performed yet
Returns:
the amount of time in milliseconds to back off before retrying the operation

shouldContinue

boolean shouldContinue()
Returns whether to continue backing off.

Returns:
whether to continue backing off