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 ...
随机推荐
- 关于package.json
1.dependencies和devDependenceis npm install packageName --save配置到dependencies,代表代码运行时所需要的插件(比如jquery, ...
- 为什么 PCB 生产时推荐出 Gerber 给工厂?
为什么 PCB 生产时推荐出 Gerber 给工厂? 事情是这样的,有一天电工王工,画了一块 PCB,发给 PCB 板厂. 过了几天 PCB 回来了,一看不对呀,这里的丝印怎么少了,那里怎么多了几条线 ...
- spring中ApplicationContextAware接口描述
项目中使用了大量的工厂类,采用了简单工厂模式: 通过该工厂类可以获取指定的处理器bean,这些处理器bean我们是从spring容器中获取的,如何获取,是通过实现ApplicationContextA ...
- malloc的使用、用malloc动态分配内存以适应用户的需求的源代码实例
int len; ; printf("please enter the size that you want: "); scanf("%d", &len ...
- 阿里云 qW3xT.4 挖矿病毒问题
查了一下.是个挖矿病毒,cpu 占用巨高 .杀了又有守护进程启动.网上有些杀死这个病毒的办法,大家可以试试.但是不确定能杀死. 建议直接重装系统. 然后,说说这货怎么传播的. 他通过redis .目前 ...
- hbase 相关
----------------------------------------hbase的 安装---------------------------------------- 本地安装: 1 解压 ...
- LOJ 2736 「JOISC 2016 Day 3」回转寿司 ——堆+分块思路
题目:https://loj.ac/problem/2736 如果每个询问都是 l = 1 , r = n ,那么每次输出序列的 n 个数与本次操作的数的最大值即可.可以用堆维护. 不同区间的询问,可 ...
- CF 316G3 Good Substrings——广义后缀自动机
题目:http://codeforces.com/contest/316/problem/G3 对询问串和模式串一起建一个后缀自动机,做出在每个串上的 right 集合大小之后枚举自动机上的每个点看看 ...
- Zookeeper Java API调用
引入zookeeper-3.4.11.jar public class ZooKeeperTest implements Watcher{ //public final static String z ...
- c++ 函数中的部分代码执行一次
编程时有时需要将一段代码中的某一块只执行一次: #include<iostream> using namespace std; int fun1(int a) { static bool ...