Class RetryableAction<Response>

java.lang.Object
org.opensearch.action.support.RetryableAction<Response>

@PublicApi(since="1.0.0") public abstract class RetryableAction<Response> extends 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.
Opensearch.api:
  • Constructor Details

    • RetryableAction

      public RetryableAction(org.apache.logging.log4j.Logger logger, ThreadPool threadPool, org.opensearch.common.unit.TimeValue initialDelay, org.opensearch.common.unit.TimeValue timeoutValue, org.opensearch.core.action.ActionListener<Response> listener)
    • RetryableAction

      public RetryableAction(org.apache.logging.log4j.Logger logger, ThreadPool threadPool, org.opensearch.common.unit.TimeValue initialDelay, org.opensearch.common.unit.TimeValue timeoutValue, org.opensearch.core.action.ActionListener<Response> listener, BackoffPolicy backoffPolicy, String executor)
  • Method Details

    • run

      public void run()
    • cancel

      public void cancel(Exception e)
    • tryAction

      public abstract void tryAction(org.opensearch.core.action.ActionListener<Response> listener)
    • shouldRetry

      public abstract boolean shouldRetry(Exception e)
    • onFinished

      public void onFinished()
    • getTimeoutException

      public Exception getTimeoutException(Exception e)
      Retry able task may want to throw different Exception on timeout, they can override it method for that.