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自带命令概览
ref:http://www.hollischuang.com/archives/308 一.常用命令 jps: 查看本机的Java中进程信息. jstack: 打印线程的执行栈信息. jmap: 打 ...
- java中token的生成和验证
package com.zjn.token; /** * token编码工具类 * @author ouyangjun */ public class TokenEncryptUtils { // 编 ...
- 深入理解Redis系列之持久化
redis持久化配置 redis.conf // RDB配置 save 900 1 save 300 10 save 60 10000 // AOF配置 appendonly yes //AOF三种同 ...
- docker配置mysql实现主从同步问题
主从同步遇到 Got fatal error 1236 from master when reading data from binary log: 'Could not find first log ...
- 用漫画的形式展现——URL和HTTP
http请求内容:请求头:get.post等发送请求(其他:head.put.delete.option) host 地址 user-Agent cookie 通行证 head:与get请求类似,不同 ...
- ConcurrentHashMap 并发之美
一.前言 她如暴风雨中的一叶扁舟,在高并发的大风大浪下疾驰而过,眼看就要被湮灭,却又在绝境中绝处逢生 编写一套即稳定.高效.且支持并发的代码,不说难如登天,却也绝非易事. 一直有小伙伴向我咨询关于Co ...
- Thread中run和start方法的模板设计模式
创建一个Thread需要继承Thread重写run方法或者实现Runnable接口中的run方法,其实两者都是一样因为Thread也继承了Runnable接口. 实现了run方法,但是启动确实用sta ...
- Java学习_泛型
什么是泛型. Java标准库提供的ArrayList内部就是一个Object[]数组,配合存储一个当前分配的长度,就可以充当"可变数组". public class ArrayLi ...
- 四、hive安装
一.安装方式(内嵌模式,本地模式远程模式) 安装环境以及前提说明: Hive是依赖于hadoop系统的,因此在运行Hive之前需要保证已经搭建好hadoop集群环境. 本例中使用的hadoop版本为2 ...
- vue-cli3 创建项目路由缺失问题
1.在项目中新建一个router.js router.js import Vue from 'vue' import Router from 'vue-router' import Home from ...