courator - create
0. retry policy
RetryPolicy retryPolicy = new ExponentialBackoffRetry(3000,3);
1. client
1) recipes
- org.apache.curator.framework.recipes.leader.LeaderSelector
- org.apache.curator.framework.recipes.cache.TreeCache
- org.apache.curator.framework.recipes.cache.PathChildrenCache
- org.apache.curator.x.discovery.ServiceDiscovery
2) CuratorFramework
- org.apache.curator.framework.CuratorFramework
(curator-framework\src\main\java\org\apache\curator\framework\CuratorFramework.java)
2.create
curator-framework\src\main\java\org\apache\curator\framework
CuratorFrameworkFactory.java
1) simple
default:
CuratorFramework newClient(String connectString, RetryPolicy retryPolicy);
client.newClient("tdtc101:2181, tdtc102:2181, tdtc103:2181", retryPolicy);
advanced:
CuratorFramework newClient(String connectString, int sessionTimeoutMs, int connectionTimeoutMs, RetryPolicy retryPolicy);
client.newClient("tdtc101:2181, tdtc102:2181, tdtc103:2181", 60 * 1000, 15 * 1000, retryPolicy);
2) Fluent style
default:
client = CuratorFrameworkFactory.builder()
.connectString("tdtc101:2181, tdtc102:2181, tdtc103:2181")
.retryPolicy(retryPolicy)
.build();
advanced:
client = CuratorFrameworkFactory.builder()
.connectString("tdtc101:2181, tdtc102:2181, tdtc103:2181")
.sessionTimeoutMs(60 * 1000) // CuratorFrameworkFactory.java Ln61
.connectionTimeoutMs(15 * 1000) // CuratorFrameworkFactory.java Ln62
.retryPolicy(retryPolicy)
.build();
3. start
client.start();
courator - create的更多相关文章
- 记一次tomcat线程创建异常调优:unable to create new native thread
测试在进行一次性能测试的时候发现并发300个请求时出现了下面的异常: HTTP Status 500 - Handler processing failed; nested exception is ...
- Could not create SSL connection through proxy serve-svn
RA layer request failedsvn: Unable to connect to a repository at URL xxxxxx 最后:Could not create SSL ...
- android 使用Tabhost 发生could not create tab content because could not find view with id 错误
使用Tabhost的时候经常报:could not create tab content because could not find view with id 错误. 总结一下发生错误的原因,一般的 ...
- Create a Team in RHEL7
SOLUTION VERIFIED September 13 2016 KB2620131 Environment Red Hat Enterprise Linux 7 NetworkManager ...
- Create a bridge using a tagged vlan (8021.q) interface
SOLUTION VERIFIED April 27 2013 KB26727 Environment Red Hat Enterprise Linux 5 Red Hat Enterprise Li ...
- [转]nopCommerce Widgets and How to Create One
本文转自:https://dzone.com/articles/what-are-nopcommerce-widgets-and-how-to-create-one A widget is a sta ...
- Git异常:fatal: could not create work tree dir 'XXX': No such file or directory
GitHub实战系列汇总:http://www.cnblogs.com/dunitian/p/5038719.html ———————————————————————————————————————— ...
- SQL Server 在多个数据库中创建同一个存储过程(Create Same Stored Procedure in All Databases)
一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 背景(Contexts) 遇到的问题(Problems) 实现代码(SQL Codes) 方法一:拼接SQL: 方法二: ...
- SharePoint 2013 create workflow by SharePoint Designer 2013
这篇文章主要基于上一篇http://www.cnblogs.com/qindy/p/6242714.html的基础上,create a sample workflow by SharePoint De ...
随机推荐
- 原码,反码,补码,及Java中数字表示方法
原码:原码是符号位加上真值的绝对值, 即用第一位表示符号, 其余位表示值. 如:如果是八位二进制1即用00000001表示,-1即用10000001表示. 反码:正数的反码就是其本身,负数的反码是在其 ...
- Netty 学习资料
Netty 学习资料 Netty 学习资料 链接网址 说明 Netty 4.x 用户指南 http://wiki.jikexueyuan.com/project/netty-4-user-guide/ ...
- uglifyjs-webpack-plugin 插件,drop_console 默认为 false(不清除 console 语句),drop_debugger 默认为 true(清除 debugger 语句)
uglifyjs-webpack-plugin 插件,drop_console 默认为 false(不清除console语句),drop_debugger 默认为 true(清除 debugger 语 ...
- npm安装教程(vue.js)
https://www.cnblogs.com/goldlong/p/8027997.html 首先理清nodejs和npm的关系: node.js是javascript的一种运行环境,是对Googl ...
- 开源自然语言处理工具包hanlp中CRF分词实现详解
CRF简介 CRF是序列标注场景中常用的模型,比HMM能利用更多的特征,比MEMM更能抵抗标记偏置的问题. [gerative-discriminative.png] CRF训练 这类耗时的任务,还 ...
- 自动加载以及Composer的实现
类的自动加载 两个函数 __autoload()魔术方法.spl_autoload_register 当php文件中使用了new关键字实例化一个对象时,如果该类没有在本php文件中被定义,将会触发__ ...
- DynArrayToVariant DynArrayFromVariant复制动态数
type intArr=array of Integer; procedure TfrmMainDA.Button2Click(Sender: TObject);var aa:intArr;bb:in ...
- DEBUG模式详解
1. 如果开启了DEBUG模式,那么以后我们修改了Django项目的代码,然后按下ctrl+s,那么Django就会自动的给我们重启项目,不需要手动重启.2. 如果开启了DEBUG模式,那么以后Dja ...
- Java封装和包的使用及定义
---恢复内容开始--- 封装的定义 特点 1只能通过规定的方法访问数据 2隐藏类的实例细节,方便修改和实现 封装的步骤 快捷创建setter/getter的方法右键然后找到SRCOSE在找到sett ...
- C# 中HttpClient的使用中同步异步问题
项目中遇到了这样的问题: 第一次 :HttpResponseMessage response = await httpClient.PostAsync(url, null);发送了一个post异步请求 ...