private boolean waitForRetry(String caller, String errMsg, int retryCount) {
    if (retryCount > 0) {
      LOG.warn("Retryable error detected in {}. Will wait {} ms and retry up to {} times. Error: {}", caller,
          retryInterval, retryCount, errMsg);
      try {
        Thread.sleep(retryInterval);
      } catch (InterruptedException ex) {
        Thread.currentThread().interrupt();
      }
      return true;
    } else {
      LOG.error("Fatal error in {}. Retry limit ({}) reached. Last error: {}", caller, retryLimit, errMsg);
    }
    return false;
  }
Determine if an exception was such that it makes sense to retry.  Unfortunately there is no standard way to do
this, so we have to inspect the error messages and catch the telltale signs for each
different database.
if the error is retry-able.
@param e exception that was thrown.
@param properties {@link SqlRetryCallProperties} instance containing the rety call settings
@return True if retry is possible, false otherwise.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/retry/SqlRetryHandler.java