prefs-zookeeper/src/main/java/com/adobe/prefs/zookeeper/ZkManager.java
public static CuratorFramework curatorFramework() {
        if (curatorFramework != null) {
            return curatorFramework;
        } else synchronized (ZkManager.class) {
            if (curatorFramework == null) {
                final String quorum = System.getProperty("zk.quorum", "localhost");
                final int sessionTimeout = Integer.parseInt(
                        System.getProperty("zk.session.timeout", "30000"));
                final int connectionTimeout = Integer.parseInt(
                        System.getProperty("zk.connection.timeout", "15000"));
                final int initialDelay = Integer.parseInt(
                        System.getProperty("zk.retry.initialDelay", "10"));
                final int maxDelay = Integer.parseInt(
                        System.getProperty("zk.retry.maxDelay", "200"));
                final int maxCount = Integer.parseInt(
                        System.getProperty("zk.retry.maxCount", "10"));


                logger.info("Initializing the Zookeeper client for quorum: {}", quorum);

                final CuratorFramework curator = CuratorFrameworkFactory.newClient(quorum, sessionTimeout, connectionTimeout,
                        new BoundedExponentialBackoffRetry(initialDelay, maxDelay, maxCount));
                curator.start();
                Runtime.getRuntime().addShutdownHook(new Thread(() -> {
                    logger.info("Shutting down the Zookeeper client...");
                    curator.close();
                }));

                curatorFramework = curator.usingNamespace(namespace("/"));

            }
            return curatorFramework;
        }

    }
/**
     * Shares the Zookeeper client used by the Preferences integration with the application code.
     * However, this method returns a facade of the original curator, so that clients cannot shut it down
     * or otherwise modify it.
     *
     * @return a singleton curator framework instance
     */
Shares the Zookeeper client used by the Preferences integration with the application code.
However, this method returns a facade of the original curator, so that clients cannot shut it down
or otherwise modify it.

@return a singleton curator framework instance
Shares the Zookeeper client used by the Preferences integration with the application code . However this method returns a facade of the original curator so that clients cannot shut it down or otherwise modify it . @return a singleton curator framework instance
public static CuratorFramework curatorFramework() {
        if (curatorFramework != null) {
            return curatorFramework;
        } else synchronized (ZkManager.class) {
            if (curatorFramework == null) {
                final String quorum = System.getProperty("zk.quorum", "localhost");
                final int sessionTimeout = Integer.parseInt(
                        System.getProperty("zk.session.timeout", "30000"));
                final int connectionTimeout = Integer.parseInt(
                        System.getProperty("zk.connection.timeout", "15000"));
                final int initialDelay = Integer.parseInt(
                        System.getProperty("zk.retry.initialDelay", "10"));
                final int maxDelay = Integer.parseInt(
                        System.getProperty("zk.retry.maxDelay", "200"));
                final int maxCount = Integer.parseInt(
                        System.getProperty("zk.retry.maxCount", "10"));
                logger.info("Initializing the Zookeeper client for quorum: {}", quorum);
                final CuratorFramework curator = CuratorFrameworkFactory.newClient(quorum, sessionTimeout, connectionTimeout,
                        new BoundedExponentialBackoffRetry(initialDelay, maxDelay, maxCount));
                curator.start();
                Runtime.getRuntime().addShutdownHook(new Thread(() -> {
                    logger.info("Shutting down the Zookeeper client...");
                    curator.close();
                }));
                curatorFramework = curator.usingNamespace(namespace("/"));
            }
            return curatorFramework;
        }
    }
public static CuratorFramework curatorFramework ( ) { if ( curatorFramework != null ) { return curatorFramework ; } else synchronized ( ZkManager . class ) { if ( curatorFramework == null ) { final String quorum = System . getProperty ( "zk.quorum" , "localhost" ) ; final int sessionTimeout = Integer . parseInt ( System . getProperty ( "zk.session.timeout" , "30000" ) ) ; final int connectionTimeout = Integer . parseInt ( System . getProperty ( "zk.connection.timeout" , "15000" ) ) ; final int initialDelay = Integer . parseInt ( System . getProperty ( "zk.retry.initialDelay" , "10" ) ) ; final int maxDelay = Integer . parseInt ( System . getProperty ( "zk.retry.maxDelay" , "200" ) ) ; final int maxCount = Integer . parseInt ( System . getProperty ( "zk.retry.maxCount" , "10" ) ) ; logger . info ( "Initializing the Zookeeper client for quorum: {}" , quorum ) ; final CuratorFramework curator = CuratorFrameworkFactory . newClient ( quorum , sessionTimeout , connectionTimeout , new BoundedExponentialBackoffRetry ( initialDelay , maxDelay , maxCount ) ) ; curator . start ( ) ; Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ( ) -> { logger . info ( "Shutting down the Zookeeper client..." ) ; curator . close ( ) ; } ) ) ; curatorFramework = curator . usingNamespace ( namespace ( "/" ) ) ; } return curatorFramework ; } }
Shares the Zookeeper client used by the Preferences integration with the application code.
Shares the Zookeeper client used by the Preferences integration with the application code .