code: public long getPersistentTimestamp() throws ChronosException {
      byte[] persistentTimesampBytes = null;
      for (int i = 0; i <= connectRetryTimes; ++i) {
        try {
          persistentTimesampBytes = ZooKeeperUtil.getDataAndWatch(this, persistentTimestampZnode);
          break;
        } catch (KeeperException e) {
          if (i == connectRetryTimes) {
            throw new ChronosException(
                "Can't get persistent timestamp from ZooKeeper after retrying", e);
          }
          LOG.info("Exception to get persistent timestamp from ZooKeeper, retry " + (i + 1) + " times");
        }
      }
  
      if (Arrays.equals(persistentTimesampBytes, new byte[0])) {
        persistentTimestamp = 0; // for the very first time
      } else {
        persistentTimestamp = ZooKeeperUtil.bytesToLong(persistentTimesampBytes);
      }
  
      if (LOG.isDebugEnabled()) {
        LOG.debug("Return persistent timestamp " + persistentTimestamp + " to timestamp server");
      }
      return persistentTimestamp;
    }
docs: Get persistent timestamp in ZooKeeper with retries.
  
  @return the persistent timestamp in ZooKeeper
  @throws ChronosException error to get data from ZooKeeper after retrying