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时候 就像服务端发起连接了
随机推荐
- 如何通过台服流出的服务端自己架设DNF
为达到更好的浏览效果,请点击原文:https://wuter.cn/513.html/ 写在最前 其实我也是dnf忠实粉丝,大概在四年级也就是2008年刚刚开始公测的时候就入坑了,一直持续到高中,目睹 ...
- 实验3 C语言分支语句和循环语句编程应用(友好猜日期^_^)
实验任务一 #include <stdio.h> #include <math.h> int main(){ float a, b, c, x1, x2; float delt ...
- 开发规范(一) 如何记录日志 By 阿里
- 发送微信通知 java
//实现类@Service public class WeChatServiceImpl implements IWeChatService { @Override public WeChatSend ...
- javaweb登陆实例
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncod ...
- windows10系统修改JDK版本后配置环境变量不生效怎么办
之前安装了个jdk8版本,今天突然想安装个更新版本的jdk11来用,但在安装好JDK11并配置环境变量后发现修改JDK版本后配置的环境变量不生效的.本文就给大家分享一下windows10系统修改JDK ...
- 在Docker下进行MyCAT管理双主双从MySQL集群
前言 在Docker下双主双从MySQL集群模拟 https://www.cnblogs.com/yumq/p/14259964.html 本文实验配置文件 Docker拉取MyCAT镜像 如果没启动 ...
- 【项目实践】一文带你搞定Spring Security + JWT
以项目驱动学习,以实践检验真知 前言 关于认证和授权,R之前已经写了两篇文章: [项目实践]在用安全框架前,我想先让你手撸一个登陆认证 [项目实践]一文带你搞定页面权限.按钮权限以及数据权限 在这两篇 ...
- 【JavaWeb】JSON 文件
JSON 文件 什么是 JSON JSON(JavaScript Object Notation),即 JS 对象符号. 是一种轻量级(相对于 XML 来说)的数据交换格式,易于阅读和编写,同时也易于 ...
- ThinkPHP5表单令牌刷新
制作登录页面的时候,加入了表单令牌,账号和密码输入错误后,再登录的话,会提示表单令牌错误, 这是因为旧的令牌已经过期了,我们要处理下前端的token,修复的办法,在路由文件下加入 //刷新表单令牌,然 ...