ExponentialBackoffExceptionHandler

public class ExponentialBackoffExceptionHandler extends Object
implements ExceptionHandler

ExceptionHandler implementation that uses exponential backoff before retrying.

Public Constructor Summary

ExponentialBackoffExceptionHandler(int maximumTries, long sleepDuration, TimeUnit sleepUnit)
Creates a handler that uses an exponentially increasing amount of sleep time to implement a backoff before retrying.

Public Method Summary

boolean
equals(Object obj)
boolean
handleException(Exception ex, int ntries)
Handles the exception by forcing an increasing wait time based on the total number of exceptions previously issued.
int

Inherited Method Summary

Public Constructors

public ExponentialBackoffExceptionHandler (int maximumTries, long sleepDuration, TimeUnit sleepUnit)

Creates a handler that uses an exponentially increasing amount of sleep time to implement a backoff before retrying.

Parameters
maximumTries how many times to try before permanent failure
sleepDuration initial sleep duration on failure
sleepUnit sleep duration time unit

Public Methods

public boolean equals (Object obj)

Parameters
obj

public boolean handleException (Exception ex, int ntries)

Handles the exception by forcing an increasing wait time based on the total number of exceptions previously issued.

This method continues to perform waits up to the maximum configured number of allowable exceptions. The return value indicates whether the calling process should issue an abort.

Parameters
ex exception denoting the error
ntries number of consecutive failures for the same operation
Returns
  • true to retry immediate, false to abort
Throws
InterruptedException if the backoff throws it

public int hashCode ()

Send feedback about...

Cloud Search
Cloud Search