class RetriableCommand {

  public T execute(Object... arguments) throws Exception {
    Exception latestException;
    int counter = 0;
    while (true) {
      try {
        return doExecute(arguments);
      } catch (Exception exception) {
        LOG.error("Failure in Retriable command: {}", description, exception);
        latestException = exception;
      }
      counter++;
      RetryAction action = retryPolicy.shouldRetry(latestException, counter, 0, true);
      if (action.action == RetryPolicy.RetryAction.RetryDecision.RETRY) {
        ThreadUtil.sleepAtLeastIgnoreInterrupts(action.delayMillis);
      } else {
        break;
      }
    }

    throw new IOException("Couldn't run retriable-command: " + description, latestException);
  }

  public  RetriableCommand(String description);
  public  RetriableCommand(String description, RetryPolicy retryPolicy);

}