public Object sendSyncRequestToConfigNodeWithRetry(
      TEndPoint endPoint, Object req, CnToCnNodeRequestType requestType) {

    Throwable lastException = null;
    for (int retry = 0; retry < MAX_RETRY_NUM; retry++) {
      try (SyncConfigNodeIServiceClient client = clientManager.borrowClient(endPoint)) {
        switch (requestType) {
          case REGISTER_CONFIG_NODE:
            // Only use registerConfigNode when the ConfigNode is first startup.
            return client.registerConfigNode((TConfigNodeRegisterReq) req);
          case ADD_CONSENSUS_GROUP:
            return client.addConsensusGroup((TAddConsensusGroupReq) req);
          case NOTIFY_REGISTER_SUCCESS:
            client.notifyRegisterSuccess();
            return null;
          case REMOVE_CONFIG_NODE:
            return removeConfigNode((TConfigNodeLocation) req, client);
          case DELETE_CONFIG_NODE_PEER:
            return client.deleteConfigNodePeer((TConfigNodeLocation) req);
          case REPORT_CONFIG_NODE_SHUTDOWN:
            return client.reportConfigNodeShutdown((TConfigNodeLocation) req);
          case STOP_AND_CLEAR_CONFIG_NODE:
            // Only use stopAndClearConfigNode when the ConfigNode is removed.
            return client.stopAndClearConfigNode((TConfigNodeLocation) req);
          case SET_CONFIGURATION:
            return client.setConfiguration((TSetConfigurationReq) req);
          case SHOW_CONFIGURATION:
            return client.showConfiguration((int) req);
          case SUBMIT_TEST_CONNECTION_TASK:
            return client.submitTestConnectionTask((TNodeLocations) req);
          case TEST_CONNECTION:
            return client.testConnectionEmptyRPC();
          default:
            return RpcUtils.getStatus(
                TSStatusCode.EXECUTE_STATEMENT_ERROR, "Unknown request type: " + requestType);
        }
      } catch (Exception e) {
        lastException = e;
        LOGGER.warn(
            "{} failed on ConfigNode {}, because {}, retrying {}...",
            requestType,
            endPoint,
            e.getMessage(),
            retry);
        doRetryWait(retry);
      }
    }
    LOGGER.error("{} failed on ConfigNode {}", requestType, endPoint, lastException);
    return RpcUtils.getStatus(
        TSStatusCode.INTERNAL_REQUEST_RETRY_ERROR,
        "All retry failed due to: " + lastException.getMessage());
  }
Synchronously send RPC requests to ConfigNode. See confignode.thrift for more details.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncConfigNodeClientPool.java