Skip to content

Instantly share code, notes, and snippets.

@ericacm
Last active October 11, 2015 23:28
Show Gist options
  • Save ericacm/3936162 to your computer and use it in GitHub Desktop.
Save ericacm/3936162 to your computer and use it in GitHub Desktop.
start Zookeeper client
def initialize() {
// Embedded server startup here (see part 2)
// ...
curatorFramework =
CuratorFrameworkFactory.newClient(
connectString, sessionTimeoutSec*1000,
connectionTimeoutSec*1000, new RetryOneTime(1))
curatorFramework.start()
curatorFramework.getZookeeperClient.blockUntilConnectedOrTimedOut()
if (!curatorFramework.isStarted) {
throw new Exception(
"Connection to Zookeeper timed out after " + connectionTimeoutSec + " seconds")
}
selectLeader()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment