private void setDataForClientZkUntilSuccess(String node, byte[] data)
    throws InterruptedException {
    boolean create = false;
    while (!server.isStopped()) {
      try {
        LOG.debug("Set data for remote " + node + ", client zk wather: " + clientZkWatcher);
        if (create) {
          ZKUtil.createNodeIfNotExistsNoWatch(clientZkWatcher, node, data, CreateMode.PERSISTENT);
        } else {
          ZKUtil.setData(clientZkWatcher, node, data);
        }
        break;
      } catch (KeeperException e) {
        LOG.debug("Failed to set data for {} to client ZK, will retry later", node, e);
        if (e.code() == KeeperException.Code.SESSIONEXPIRED) {
          reconnectAfterExpiration();
        }
        if (e.code() == KeeperException.Code.NONODE) {
          create = true;
        }
        if (e.code() == KeeperException.Code.NODEEXISTS) {
          create = false;
        }
      }
      Threads.sleep(HConstants.SOCKET_RETRY_WAIT_MS);
    }
  }
Set data for client ZK and retry until succeed. Be very careful to prevent dead loop when
modifying this method
@param node the znode to set on client ZK
@param data the data to set to client ZK
@throws InterruptedException if the thread is interrupted during process
hbase-server/src/main/java/org/apache/hadoop/hbase/master/zksyncer/ClientZKSyncer.java