protected TTransport connectWithRetry(int retries) throws HiveSQLException {
    TTransportException exception = null;
    for (int i = 0 ; i < retries; i++) {
      try {
        return connect(conf);
      } catch (TTransportException e) {
        exception = e;
        LOG.warn("Connection attempt " + i, e);
      }
      try {
        Thread.sleep(retryDelaySeconds * 1000);
      } catch (InterruptedException e) {
        LOG.warn("Interrupted", e);
      }
    }
    throw new HiveSQLException("Unable to connect after " + retries + " retries", exception);
  }
RetryingThriftCLIServiceClient. Creates a proxy for a CLIServiceClient
implementation and retries calls to it on failure.
service/src/java/org/apache/hive/service/cli/thrift/RetryingThriftCLIServiceClient.java