private Pair<Integer, String> execWithRetries(String user, String cmd) throws IOException {
    RetryCounter retryCounter = retryCounterFactory.create();
    while (true) {
      try {
        return exec(user, cmd);
      } catch (IOException e) {
        retryOrThrow(retryCounter, e, user, cmd);
      }
      try {
        retryCounter.sleepUntilNextRetry();
      } catch (InterruptedException e) {
        LOG.warn("Sleep Interrupted: " + e);
      }
    }
  }
Below function executes command with retries with given user. Uses LocalShell to execute a
command.
@param user user name, default none
@param cmd  Command to execute
@return A pair of Exit Code and Shell output
@throws IOException Exception while executing shell command
hbase-it/src/main/java/org/apache/hadoop/hbase/chaos/ChaosAgent.java