private void waitUntilAllReplicationPeerModificationProceduresDone(
    CompletableFuture<Boolean> future, boolean prevOn, int retries) {
    CompletableFuture<List<ProcedureProtos.Procedure>> callFuture =
      this.<List<ProcedureProtos.Procedure>> newMasterCaller()
        .action((controller, stub) -> this.<GetReplicationPeerModificationProceduresRequest,
          GetReplicationPeerModificationProceduresResponse, List<ProcedureProtos.Procedure>> call(
            controller, stub, GetReplicationPeerModificationProceduresRequest.getDefaultInstance(),
            (s, c, req, done) -> s.getReplicationPeerModificationProcedures(c, req, done),
            resp -> resp.getProcedureList()))
        .call();
    addListener(callFuture, (r, e) -> {
      if (e != null) {
        future.completeExceptionally(e);
      } else if (r.isEmpty()) {
        // we are done
        future.complete(prevOn);
      } else {
        // retry later to see if the procedures are done
        retryTimer.newTimeout(
          t -> waitUntilAllReplicationPeerModificationProceduresDone(future, prevOn, retries + 1),
          ConnectionUtils.getPauseTime(pauseNs, retries), TimeUnit.NANOSECONDS);
      }
    });
  }
Set the table's replication switch if the table's replication switch is already not set.
@param tableName name of the table
@param enableRep is replication switch enable or disable
hbase-client/src/main/java/org/apache/hadoop/hbase/client/RawAsyncHBaseAdmin.java