Create a gist now

Instantly share code, notes, and snippets.

watchLeaderChildren
def watchLeaderChildren() {
curatorFramework.getChildren.usingWatcher(
new CuratorWatcher {
def process(event: WatchedEvent) {
val cs = clusterStatus()
// Do something with cluster status (log leadership change, etc)
// Re-set watch
curatorFramework.getChildren.usingWatcher(this).
inBackground.forPath(leaderPath)
}
}).inBackground.forPath(leaderPath)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment