Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public static CuratorFramework createConnection(String zookeeperConnectionString) {
//First retry will wait for 1 second,
//the second will wait up to 2 seconds,
//the third will wait upto 4 seconds.
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
CuratorFramework client = CuratorFrameworkFactory.builder()
.connectString(zookeeperConnectionString)
.retryPolicy(retryPolicy)
.namespace("session_service")
.canBeReadOnly(true)
.zookeeperFactory(new DefaultZookeeperFactory())
.build();
client.start();
return client;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment