Zookeeper实例Curator API-使用Fluent风格的API接口来创建一个ZooKeeper客户端
来源:互联网 发布:多益网络校招笔试题 编辑:程序博客网 时间:2024/05/17 04:23
/** * * @ClassName: Create_Session_Sample_fluent * @Description: TODO(使用Fluent风格的API接口来创建一个ZooKeeper客户端) * @author RongShu * @date 2017年6月17日 上午9:46:35 * */public class Create_Session_Sample_fluent {public static void main(String[] args) throws Exception {RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);CuratorFramework client = CuratorFrameworkFactory.builder().connectString("localhosts:2181").sessionTimeoutMs(5000).retryPolicy(retryPolicy).build();client.start();Thread.sleep(Integer.MAX_VALUE);}}
注意:
Curator提供的API接口在设计商最大的亮点在于遵循了Fluent设计风格,这也是和Zookeeper原生API以及ZkClient客户端有很大的不同地方。
参考
1.《从Paxos到Zookeeper:分布式一致性原理与实践》
2. http://curator.apache.org/apidocs/
阅读全文
0 0
- Zookeeper实例Curator API-使用Fluent风格的API接口来创建一个ZooKeeper客户端
- Zookeeper实例Curator API-使用curator来创建一个含隔离命名空间的ZooKeeper客户端
- Zookeeper实例Curator API-使用curator来创建一个ZooKeeper客户端
- Zookeeper实例Curator API-使用Curator的异步接口
- Zookeeper实例Curator API-使用Curator创建节点
- Zookeeper实例Curator API-NodeCache使用实例
- Zookeeper实例Curator API-ZKPaths使用
- Zookeeper实例Curator API-EnsurePath使用
- Zookeeper实例ZkClient API-创建一个Zookeeper客户端
- Zookeeper实例Curator API-PathChildrenCache
- Zookeeper实例Curator API-PathChildrenCache_NoCacheData
- Zookeeper实例Curator API-TestingServer
- Zookeeper实例Curator API-TestingCluster
- Zookeeper实例Curator API-使用Curator删除节点
- Zookeeper实例Curator API-使用Curator获取数据内容
- Zookeeper实例Curator API-使用Curator更新数据内容
- Zookeeper实例原生API--创建一个基本的Zookeeper会话
- zk007 zookeeper curator api
- imgproc模块--Remapping重映射
- QT日常代码二
- 读写分离如何实现?
- 文章标题
- 异常处理
- Zookeeper实例Curator API-使用Fluent风格的API接口来创建一个ZooKeeper客户端
- C#177课的主要内容
- Android_ListView优化
- SlidingMenu和日夜间模式结合使用
- JS实现浏览器的title闪烁、滚动、声音提示、通知
- ios代码添加UIViewController对应的view作为子控件
- Ubuntu上装windows10结果进不到Ubuntu了- -||
- 扫雷游戏问题
- AndroidStudio SVN插件配置与使用 标签: svn 2016-07-13