Skip to content

Commit

Permalink
moved the sample code to #27 and #28
Browse files Browse the repository at this point in the history
  • Loading branch information
arun-gupta committed Jun 12, 2015
1 parent caac7b0 commit 587391a
Showing 1 changed file with 1 addition and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,10 @@ public String discoverService(String name) {
CuratorFramework curatorFramework = CuratorFrameworkFactory.newClient(host + ":" + port, new RetryNTimes(5, 1000));
curatorFramework.start();
String znode = "/services/" + name;

// Level 1: simplest thing to do

List<String> uris = curatorFramework.getChildren().forPath(znode);
String child = uris.get(0);
return new String(curatorFramework.getData().forPath(ZKPaths.makePath(znode, child)));

// // Level 2: register watches to check the status of the service
// uris = curatorFramework.getChildren().usingWatcher(new Watcher() {
// @Override
// public void process(WatchedEvent we) {
// if (we.getType() == Event.EventType.NodeDeleted) {}
// }
// }).forPath(znode);
//
// // Level 3: Done during initialization
// PathChildrenCache pcache = new PathChildrenCache(curatorFramework, znode, true);
// pcache.start();
//
// List<ChildData> childdata = pcache.getCurrentData();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
Expand Down

0 comments on commit 587391a

Please sign in to comment.