code: private static void handleRpcException(RpcException e, int attemptNumber, String server) throws IOException {
          String messageStart;
          if (!(e.getStatus().equals(RpcStatus.NETWORK_ERROR))) {
              messageStart = "network";
          } else {
              // check whether to retry
              if (attemptNumber + 1 < _maxRetry) {
                  return;
              }
              messageStart = "rpc";
          }
          throw new IOException(
                  String.format("%s error, server: %s, RPC error: %s", messageStart, server, e.getMessage()), e);
      }
docs: Decide whether to retry or throw exception.
  
  @param e
  The exception.
  @param attemptNumber
  The number of attempts so far.
  @throws IOException