public static RecoverableZooKeeper connect(ZKConfig zkConfig,
            Watcher watcher) throws IOException {
        if (zkConfig.getZkServerAddr() == null) {
            throw new IOException("Unable to determine ZooKeeper Server Address String");
        }
        return new RecoverableZooKeeper(zkConfig.getZkServerAddr(),
                zkConfig.getZkSessionTimeoutMs(), watcher, RETRY_TIMES, RETRY_INTERVAL);
    }
Creates a new connection to ZooKeeper, pulling settings and ensemble config from the
specified configuration object using methods from {@link ZKConfig} .
<p/>
Sets the connection status monitoring watcher to the specified watcher.
<p/>
configuration to pull ensemble and other settings from

@param watcher watcher to monitor connection changes
@return connection to zookeeper
@throws IOException if unable to connect to zk or config problem
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/common/zookeeper/ZKUtil.java