use of com.bonree.brfs.common.zookeeper.curator.leader.CuratorLeaderSelectorClient in project BRFS by zhangnianli.
the class LeaderTest method main.
public static void main(String[] args) throws InterruptedException, IOException {
String path = "/brfs/wz/leader";
LeaderSelectorListener l1 = new MyLeaderListener("listener1");
LeaderSelectorListener l2 = new MyLeaderListener("listener2");
CuratorLeaderSelectorClient leaderSelector = CuratorLeaderSelectorClient.getLeaderSelectorInstance("192.168.101.86:2181");
leaderSelector.addSelector(path, l1);
leaderSelector.addSelector(path, l2);
// Thread.sleep(Long.MAX_VALUE);
Thread.sleep(10000);
System.out.println(leaderSelector.getSelectorListeners(path));
Thread.sleep(30000);
leaderSelector.removeAllSelector(path);
Thread.sleep(Long.MAX_VALUE);
}
Aggregations