设为首页 加入收藏

TOP

基于 ZooKeeper 的分布式锁和队列(四)
2017-10-22 06:06:45 】 浏览:778
Tags:基于 ZooKeeper 分布式 队列
tenerAdapter() { public void takeLeadership(CuratorFramework client) throws Exception { // this callback will get called when you are the leader // do whatever leader work you need to and only exit // this method when you want to relinquish leadership } } LeaderSelector selector = new LeaderSelector(client, path, listener); selector.autoRequeue(); // not required, but this is behavior that you will probably expect selector.start();

参考:

  • http://zookeeper.apache.org/doc/trunk/recipes.html
  • http://curator.apache.org/curator-recipes/index.html
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 4/9/9
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇就是要你懂 Java 中 volatile 关.. 下一篇基于 Spring Boot 的天气预报服务

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目