Last active
October 11, 2015 23:28
-
-
Save ericacm/3936162 to your computer and use it in GitHub Desktop.
start Zookeeper client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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