Last active
October 11, 2015 23:27
-
-
Save ericacm/3935889 to your computer and use it in GitHub Desktop.
watchLeaderChildren
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 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