private static <T> T retry(Supplier<T> s) {
    Exception ex = null;
    int myRetryLimit = retryLimit;
    while (myRetryLimit > 0) {
      try {
        return s.get();
      } catch (Exception e) {
        myRetryLimit--;
        boolean retriable = isRetriableException(e);
        if (myRetryLimit > 0 && retriable) {
          LOG.info("Retriable exception while invoking method, retrying. {} attempts left",
              myRetryLimit, e);
          try {
            Thread.sleep(retryInterval);
          } catch (InterruptedException ie) {
            // Restore the interrupted status, since we do not want to catch it.
            LOG.debug("Interrupted while sleeping before retrying.", ie);
            Thread.currentThread().interrupt();
          }
          // If we're here, we'll proceed down the next while loop iteration.
        } else {
          // we've reached our limit, throw the last one.
          if (retriable) {
            LOG.warn("Exception retry limit reached, not retrying any longer.", e);
          } else {
            LOG.debug("Non-retriable exception.", e);
            break;
          }
          ex = e;
        }
      }
    }
    throw new RuntimeException(ex);
  }
To make possible to run multiple metastore in unit test

@param twoMetastoreTesting if we are using multiple metastore in unit test
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/PersistenceManagerProvider.java