本文整理了Java中org.apache.zookeeper.server.ZooKeeperServer.serverStats()
方法的一些代码示例,展示了ZooKeeperServer.serverStats()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperServer.serverStats()
方法的具体详情如下:
包路径:org.apache.zookeeper.server.ZooKeeperServer
类名称:ZooKeeperServer
方法名:serverStats
暂无
代码示例来源:origin: apache/zookeeper
@Override
protected ServerStats serverStats() {
if (zkServer == null) {
return null;
}
return zkServer.serverStats();
}
代码示例来源:origin: apache/zookeeper
@Override
protected ServerStats serverStats() {
if (zkServer == null) {
return null;
}
return zkServer.serverStats();
}
代码示例来源:origin: apache/zookeeper
public long getPacketsReceived() {
return zks.serverStats().getPacketsReceived();
}
代码示例来源:origin: apache/zookeeper
public double getAvgRequestLatency() {
return zks.serverStats().getAvgLatency();
}
代码示例来源:origin: apache/zookeeper
public long getMaxRequestLatency() {
return zks.serverStats().getMaxLatency();
}
代码示例来源:origin: apache/zookeeper
public long getFsyncThresholdExceedCount() {
return zks.serverStats().getFsyncThresholdExceedCount();
}
代码示例来源:origin: apache/zookeeper
public void resetLatency() {
zks.serverStats().resetLatency();
}
代码示例来源:origin: apache/zookeeper
public long getMinRequestLatency() {
return zks.serverStats().getMinLatency();
}
代码示例来源:origin: apache/zookeeper
public long getPacketsSent() {
return zks.serverStats().getPacketsSent();
}
代码示例来源:origin: apache/zookeeper
public void resetFsyncThresholdExceedCount() {
zks.serverStats().resetFsyncThresholdExceedCount();
}
代码示例来源:origin: apache/zookeeper
@Override
public int getLastClientResponseSize() {
return zks.serverStats().getClientResponseStats().getLastBufferSize();
}
代码示例来源:origin: apache/zookeeper
@Override
public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
CommandResponse response = initializeResponse();
zkServer.serverStats().reset();
return response;
}
}
代码示例来源:origin: apache/zookeeper
@Override
public int getMaxClientResponseSize() {
return zks.serverStats().getClientResponseStats().getMaxBufferSize();
}
代码示例来源:origin: apache/zookeeper
@Override
public int getMinClientResponseSize() {
return zks.serverStats().getClientResponseStats().getMinBufferSize();
}
代码示例来源:origin: apache/zookeeper
private void updateStats(Request request, String lastOp, long lastZxid) {
if (request.cnxn == null) {
return;
}
long currentTime = Time.currentElapsedTime();
zks.serverStats().updateLatency(request, currentTime);
request.cnxn.updateStatsForResponse(request.cxid, lastZxid, lastOp,
request.createTime, currentTime);
}
}
代码示例来源:origin: apache/zookeeper
public void resetStatistics() {
ServerStats serverStats = zks.serverStats();
serverStats.resetRequestCounters();
serverStats.resetLatency();
serverStats.resetFsyncThresholdExceedCount();
}
代码示例来源:origin: apache/zookeeper
@Override
public void commandRun() {
if (!isZKServerRunning()) {
pw.println(ZK_NOT_SERVING);
} else {
ServerStats serverStats = zkServer.serverStats();
serverStats.reset();
if (serverStats.getServerState().equals("leader")) {
((LeaderZooKeeperServer)zkServer).getLeader().getProposalStats().reset();
}
pw.println("Server stats reset.");
}
}
}
代码示例来源:origin: apache/zookeeper
@Before
public void setUp() {
outputWriter = new StringWriter();
ServerCnxn serverCnxnMock = mock(ServerCnxn.class);
zks = mock(ZooKeeperServer.class);
when(zks.isRunning()).thenReturn(true);
serverStats = mock(ServerStats.class);
when(zks.serverStats()).thenReturn(serverStats);
statResetCommand = new StatResetCommand(new PrintWriter(outputWriter), serverCnxnMock);
statResetCommand.setZkServer(zks);
}
代码示例来源:origin: apache/zookeeper
@Test
public void testClientResponseStatsUpdate() throws IOException, InterruptedException, KeeperException {
try (ZooKeeper zk = createClient()) {
BufferStats clientResponseStats = serverFactory.getZooKeeperServer().serverStats().getClientResponseStats();
assertThat("Last client response size should be initialized with INIT_VALUE",
clientResponseStats.getLastBufferSize(), equalTo(BufferStats.INIT_VALUE));
zk.create("/a", "test".getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
assertThat("Last client response size should be greater than 0 after client request was performed",
clientResponseStats.getLastBufferSize(), greaterThan(0));
byte[] contents = zk.getData("/a", null, null);
assertArrayEquals("unexpected data", "test".getBytes(), contents);
}
}
代码示例来源:origin: apache/zookeeper
@Test
public void testClientResponseStatsUpdate() throws IOException, InterruptedException, KeeperException {
try (ZooKeeper zk = createClient()) {
BufferStats clientResponseStats = serverFactory.getZooKeeperServer().serverStats().getClientResponseStats();
assertThat("Last client response size should be initialized with INIT_VALUE",
clientResponseStats.getLastBufferSize(), equalTo(BufferStats.INIT_VALUE));
zk.create("/a", "test".getBytes(), Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
assertThat("Last client response size should be greater then zero after client request was performed",
clientResponseStats.getLastBufferSize(), greaterThan(0));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!