Package org.elasticsearch.action.support
Class RetryableAction<Response>
java.lang.Object
org.elasticsearch.action.support.RetryableAction<Response>
public abstract class RetryableAction<Response>
extends java.lang.Object
A action that will be retried on failure if
shouldRetry(Exception) returns true.
The executor the action will be executed on can be defined in the constructor. Otherwise, SAME is the
default. The action will be retried with exponentially increasing delay periods until the timeout period
has been reached.-
Constructor Summary
Constructors Constructor Description RetryableAction(org.apache.logging.log4j.Logger logger, ThreadPool threadPool, org.elasticsearch.common.unit.TimeValue initialDelay, org.elasticsearch.common.unit.TimeValue timeoutValue, ActionListener<Response> listener)RetryableAction(org.apache.logging.log4j.Logger logger, ThreadPool threadPool, org.elasticsearch.common.unit.TimeValue initialDelay, org.elasticsearch.common.unit.TimeValue timeoutValue, ActionListener<Response> listener, java.lang.String executor) -
Method Summary
Modifier and Type Method Description protected longcalculateDelay(long previousDelay)voidcancel(java.lang.Exception e)protected longminimumDelayMillis()voidonFinished()voidrun()abstract booleanshouldRetry(java.lang.Exception e)abstract voidtryAction(ActionListener<Response> listener)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
RetryableAction
public RetryableAction(org.apache.logging.log4j.Logger logger, ThreadPool threadPool, org.elasticsearch.common.unit.TimeValue initialDelay, org.elasticsearch.common.unit.TimeValue timeoutValue, ActionListener<Response> listener) -
RetryableAction
public RetryableAction(org.apache.logging.log4j.Logger logger, ThreadPool threadPool, org.elasticsearch.common.unit.TimeValue initialDelay, org.elasticsearch.common.unit.TimeValue timeoutValue, ActionListener<Response> listener, java.lang.String executor)
-
-
Method Details
-
run
public void run() -
cancel
public void cancel(java.lang.Exception e) -
tryAction
-
shouldRetry
public abstract boolean shouldRetry(java.lang.Exception e) -
calculateDelay
protected long calculateDelay(long previousDelay) -
minimumDelayMillis
protected long minimumDelayMillis() -
onFinished
public void onFinished()
-