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的更多相关文章

  1. 记一次tomcat线程创建异常调优:unable to create new native thread

    测试在进行一次性能测试的时候发现并发300个请求时出现了下面的异常: HTTP Status 500 - Handler processing failed; nested exception is ...

  2. 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 ...

  3. 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 错误. 总结一下发生错误的原因,一般的 ...

  4. Create a Team in RHEL7

    SOLUTION VERIFIED September 13 2016 KB2620131 Environment Red Hat Enterprise Linux 7 NetworkManager ...

  5. 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 ...

  6. [转]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 ...

  7. Git异常:fatal: could not create work tree dir 'XXX': No such file or directory

    GitHub实战系列汇总:http://www.cnblogs.com/dunitian/p/5038719.html ———————————————————————————————————————— ...

  8. SQL Server 在多个数据库中创建同一个存储过程(Create Same Stored Procedure in All Databases)

    一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 背景(Contexts) 遇到的问题(Problems) 实现代码(SQL Codes) 方法一:拼接SQL: 方法二: ...

  9. SharePoint 2013 create workflow by SharePoint Designer 2013

    这篇文章主要基于上一篇http://www.cnblogs.com/qindy/p/6242714.html的基础上,create a sample workflow by SharePoint De ...

随机推荐

  1. iuplua test failure

    prepared SW  Download from https://sourceforge.net/projects/iup zerobrane Step Write follwiing codes ...

  2. bzoj 3600 没有人的算术——二叉查找树动态标号

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3600 已知 l 和 r 的排名,想快速知道 k 的排名.那么建一个 BIT ,用已知的排名做 ...

  3. Zookeeper 基本概念学习

    1.Zookeeper简介: 1) 中间件,为分布式系统提供协调服务 2) 作用于分布式系统,发挥其优势,可以为大数据服务 3) 支持Java,提供java和c语言的客户端api 2. 分布式系统 1 ...

  4. Zookeeper Ha集群简介+jdbcClient访问Ha集群环境

    Hadoop-HA机制HA概述high available(高可用) 所谓HA(high available),即高可用(7*24小时不中断服务). 实现高可用最关键的策略是消除单点故障.HA严格来说 ...

  5. 网易云课堂Dubbo学习笔记

    可以在这里下载dubbo的原码:https://github.com/alibaba/dubbo Dubbo架构原理:

  6. 修改postfix smtp端口,防止公网扫描浪费你的服务器流量

    邮件服务器的默认发送邮件端口是25,一些ISP会封锁25端口防止垃圾邮件的发送,这样就导致不能使用Foxmail.outlook等邮件客户端发送邮件.修改默认smtp端口就可以解决这个问题.下面的方法 ...

  7. 阅读<Vivado Design Suite Tutorial---Logic Simulation>笔记

    阅读<Vivado Design Suite Tutorial---Logic Simulation>笔记 1.建工程,添加仿真文件 2.在IP Catalog里面添加IP核 Sine_h ...

  8. 在本机将本机的ip和mac绑定

    cmd命令框中输入arp -s ip mac即可绑定 解除绑定:arp -d ip

  9. C#中winform使用相对路径读取文件的方法

    http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece763105392230e54f73b6cd0d3027fa3cf1fd579080101 ...

  10. 跟着未名学Office - 高效笔记OneNote

    了解OneNote 2016年12月22日    19:57 OneNote Summary 理解OneNote中的笔记本.分区.页的概念 编写人:未名 感谢秦大: http://www.zloffi ...