public T run() throws Exception {
      int attempt = 0;
      while (true) {
        int size = getNextBatchSize();
        if (size == 0) {
          throw new RetryException("Batch size reduced to zero");
        }
        try {
          return execute(size);
        } catch (Exception ex) {
          LOG.warn("Exception thrown while processing using a batch size {}", size, ex);
        } finally {
          attempt++;
          if (attempt == maxRetries) {
            throw new RetryException("Maximum number of retry attempts %d exhausted".formatted(maxRetries));
          }
        }
      }
    }
This class is a base implementation of a simple exponential back retry policy. The batch size
and decaying factor are provided with the constructor. It reduces the batch size by dividing
it by the decaying factor every time there is an exception in the execute method.
common/src/java/org/apache/hive/common/util/RetryUtilities.java