int ping = 11; 限流 客户端验证与服务端是连接的
int ping = 11;
ZooKeeper Programmer's Guide https://zookeeper.apache.org/doc/r3.1.2/zookeeperProgrammers.html
The session is kept alive by requests sent by the client. If the session is idle for a period of time that would timeout the session, the client will send a PING request to keep the session alive. This PING request not only allows the ZooKeeper server to know that the client is still active, but it also allows the client to verify that its connection to the ZooKeeper server is still active. The timing of the PING is conservative enough to ensure reasonable time to detect a dead connection and reconnect to a new server.
https://github.com/apache/zookeeper/blob/master/zookeeper-server/src/main/java/org/apache/zookeeper/server/Request.java#L124
| public boolean isThrottlable() { | |
| return this.type != OpCode.ping | |
| && this.type != OpCode.closeSession | |
| && this.type != OpCode.createSession; | |
| } | |
zookeeper/ZooDefs.java at master · apache/zookeeper https://github.com/apache/zookeeper/blob/master/zookeeper-server/src/main/java/org/apache/zookeeper/ZooDefs.java
| public interface OpCode { | |
| int notification = 0; | |
| int create = 1; | |
| int delete = 2; | |
| int exists = 3; | |
| int getData = 4; | |
| int setData = 5; | |
| int getACL = 6; | |
| int setACL = 7; | |
| int getChildren = 8; | |
| int sync = 9; | |
| int ping = 11; | |
| int getChildren2 = 12; | |
| int check = 13; | |
| int multi = 14; | |
| int create2 = 15; | |
| int reconfig = 16; | |
| int checkWatches = 17; | |
| int removeWatches = 18; | |
| int createContainer = 19; | |
| int deleteContainer = 20; | |
| int createTTL = 21; | |
| int multiRead = 22; | |
| int auth = 100; | |
| int setWatches = 101; | |
| int sasl = 102; | |
| int getEphemerals = 103; | |
| int getAllChildrenNumber = 104; | |
| int setWatches2 = 105; | |
| int addWatch = 106; | |
| int createSession = -10; | |
| int closeSession = -11; | |
| int error = -1; | |
| } |
int ping = 11; 限流 客户端验证与服务端是连接的的更多相关文章
- 6-1 建立客户端与zk服务端的连接
6-1 建立客户端与zk服务端的连接 zookeeper原生java api使用 会话连接与恢复; 节点的增删改查; watch与acl的相关操作; 导入jar包;
- java版gRPC实战之六:客户端动态获取服务端地址
欢迎访问我的GitHub https://github.com/zq2599/blog_demos 内容:所有原创文章分类汇总及配套源码,涉及Java.Docker.Kubernetes.DevOPS ...
- jQuery结合Ajax实现简单的前端验证和服务端查询
上篇文章写了简单的前端验证由传统的JavaScript转向流畅的jQuery滑动验证,现在拓展一下,使用Ajax实现用户体验比较好的异步查询,同样还是从建立一个简单的表单开始 <form nam ...
- C#使用Thrift简介,C#客户端和Java服务端相互交互
C#使用Thrift简介,C#客户端和Java服务端相互交互 本文主要介绍两部分内容: C#中使用Thrift简介 用Java创建一个服务端,用C#创建一个客户端通过thrift与其交互. 用纯C#实 ...
- TCP学习之二:客户端与服务端的连接
主要参考张子阳大神的博客:http://www.cnblogs.com/JimmyZhang/category/101698.html TcpClient是对Socket的封装 一个TcpClient ...
- Android客户端与PHP服务端交互(一)---框架概述
背景 作为一个普通上班族,总是想做一些自认为有意义的事情,于是乎准备成立一个工作室,尽管目前正在筹备阶段,但是之前有些朋友提出一些需求的时候,我发现自己的能力还是有限,直到最近和一些技术牛朋友聊起这事 ...
- 利用python多线程实现多个客户端与单个服务端的远程ssh
本次实验设计两个方面的代码,第一个是客户端,代码如下: import os from socket import * c = socket(AF_INET,SOCK_STREAM) c.connect ...
- android客户端app和服务端交互token的作用
Android客户端和服务端如何使用Token和Session niceheart关注1人评论34644人阅读2014-09-16 16:38:44 对于初学者来说,对Token和Session的 ...
- 客户端 new socket时候 就像服务端发起连接了
客户端 new socket时候 就像服务端发起连接了
随机推荐
- Java 中的PO VO DTO BO
PO 持久对象,数据: BO 业务对象,封装对象.复杂对象 ,里面可能包含多个类:DTO 传输对象,前端调用时传输 :VO 表现对象,前端界面展示. 当你业务足够简单时,一个POJO 也完全当做PO ...
- [leetcode]79.Search Word 回溯法
/** * Given a 2D board and a word, find if the word exists in the grid. The word can be constructed ...
- 在搜索引擎中输入汉字就可以解析到对应的域名,请问如何用LoadRunner进行测试。
建立测试计划,确定测试标准和测试范围 设计典型场景的测试用例,覆盖常用业务流程和不常用的业务流程等 根据测试用例,开发自动测试脚本和场景: 录制测试脚本:新建一个脚本(Web/HTML协议):点 ...
- vue-element Form表单验证(表单验证没错却一直提示错误)
在使用element-UI 的表单时,发生一个验证错误,例如已输入值但求验证纠错: 代码如下所示: <el-form :model="correction" :i ...
- Spring Cloud是什么鬼?
研究了一段时间Spring Boot了准备向Spring Cloud进发,公司架构和项目也全面拥抱了Spring Cloud.在使用了一段时间后发现Spring Cloud从技术架构上降低了对大型系统 ...
- JAVA并发包——锁
1.java多线程中,可以使用synchronized关键字来实现线程间的同步互斥工作,其实还有个更优秀的机制来完成这个同步互斥的工作--Lock对象,主要有2种锁:重入锁和读写锁,它们比synchr ...
- Android——spinner控件实现读取xml资源,省、市两级互动
(1)首先在res文件夹下面的values中创建一个省市arrays.xml文件夹,如下 <?xml version="1.0" encoding="utf-8&q ...
- python之 logging 模块(上篇)
一.日志关概念 日志是一种可以追踪某些软件运行时所发生事件的方法.软件开发人员可以向他们的代码中调用日志记录相关的方法来表明发生了某些事情.一个事件可以用一个可包含可选变量数据的消息来描述.此外,事件 ...
- spring*.xml配置文件明文加密
spring*.xml配置文件明文加密 说明:客户要求spring*.xml中Oracle/Redis/MongoDB的IP.端口.用户名.密码不能明文存放,接到需求的我,很无奈,但是还是的硬着头皮搞 ...
- 【分享】wdcp服务器管理系统常用维护工具
wdcp (WDlinux Control Panel) 是一套用PHP开发的Linux服务器管理系统,类似国外流行的cpanel,旨在易于使用和管理Linux服务器,可以在线通过网页管理服务器和虚拟 ...