private void waitFor(final Callable<Boolean> predicate) {
    final RetryCounter retryCounter = retryCounterFactory.create();
    while (true) {
      try {
        if (Objects.equals(true, predicate.call())) {
          return;
        }
      } catch (Exception e) {
        if (retryCounter.shouldRetry()) {
          LOG.debug("execution failed with exception. Retrying.", e);
        } else {
          throw new RuntimeException("retries exhausted", e);
        }
      }
      try {
        retryCounter.sleepUntilNextRetry();
      } catch (InterruptedException e) {
        throw new RuntimeException(e);
      }
    }
  }
Helper method for executing retryable work.
hbase-it/src/test/java/org/apache/hadoop/hbase/RESTApiClusterManager.java