code: public static  <T> T executeWithRetry(Supplier<T> supplier) {
  		boolean retry = false;
  		int retries = 0;
  
  		do {
  
  			try {
  
  				return supplier.get();
  
  			} catch (RetryException ex) {
  
  				logger.info("Caught RetryException in executeWithRetry. Waiting " + (retries > 0 ? retryDelay : firstRetryDelay) + " ms and then performing retry #" + retries);
  
  				try {
  
  					Thread.sleep(retries > 0 ? retryDelay : firstRetryDelay);
  				} catch (InterruptedException iex) {
  
  					break;
  				}
  
  				retry = true;
  				retries ++;
  
  			}
  
  		} while (retry && retries < maxRetries);
  
  		throw new RetryException("executeWithRetry exceeded maximum amount of retries.");
  	}
docs: ---- public static methods ----