@Test public void testTxnLogElapsedSyncTime() throws IOException { File tmpDir = ClientBase.createTmpDir(); FileTxnSnapLog fileTxnSnapLog = new FileTxnSnapLog(new File(tmpDir, "data"), new File(tmpDir, "data_txnlog")); ZooKeeperServer zks = new ZooKeeperServer(); zks.setTxnLogFactory(fileTxnSnapLog); ZooKeeperServerBean serverBean = new ZooKeeperServerBean(zks); long elapsedTime = serverBean.getTxnLogElapsedSyncTime(); assertEquals(-1, elapsedTime); TxnHeader hdr = new TxnHeader(1, 1, 1, 1, ZooDefs.OpCode.setData); Record txn = new SetDataTxn("/foo", new byte[0], 1); Request req = new Request(0, 0, 0, hdr, txn, 0); try { zks.getTxnLogFactory().append(req); zks.getTxnLogFactory().commit(); elapsedTime = serverBean.getTxnLogElapsedSyncTime(); assertNotEquals(-1, elapsedTime); assertEquals(elapsedTime, serverBean.getTxnLogElapsedSyncTime()); } finally { fileTxnSnapLog.close(); } }
@Override public long getTxnLogElapsedSyncTime() { return zks.getTxnLogElapsedSyncTime(); }
ZooKeeperServerBean implements ZooKeeperServerMXBean, ZKMBeanInfo { @Override public long getTxnLogElapsedSyncTime() { return zks.getTxnLogElapsedSyncTime(); } }
ZooKeeperServerBean implements ZooKeeperServerMXBean, ZKMBeanInfo { @Override public long getTxnLogElapsedSyncTime() { return zks.getTxnLogElapsedSyncTime(); } ZooKeeperServerBean(ZooKeeperServer zks); }
ZooKeeperServerBean implements ZooKeeperServerMXBean, ZKMBeanInfo { @Override public long getTxnLogElapsedSyncTime() { return zks.getTxnLogElapsedSyncTime(); } ZooKeeperServerBean(ZooKeeperServer zks); String getClientPort(); String getName(); boolean isHidden(); String getStartTime(); String getVersion(); long getAvgRequestLatency(); long getMaxRequestLatency(); long getMinRequestLatency(); long getOutstandingRequests(); int getTickTime(); void setTickTime(int tickTime); int getMaxClientCnxnsPerHost(); void setMaxClientCnxnsPerHost(int max); int getMinSessionTimeout(); void setMinSessionTimeout(int min); int getMaxSessionTimeout(); void setMaxSessionTimeout(int max); long getDataDirSize(); long getLogDirSize(); long getPacketsReceived(); long getPacketsSent(); long getFsyncThresholdExceedCount(); void resetLatency(); void resetMaxLatency(); void resetFsyncThresholdExceedCount(); void resetStatistics(); long getNumAliveConnections(); @Override String getSecureClientPort(); @Override String getSecureClientAddress(); @Override long getTxnLogElapsedSyncTime(); @Override int getJuteMaxBufferSize(); @Override int getLastClientResponseSize(); @Override int getMinClientResponseSize(); @Override int getMaxClientResponseSize(); }
ZooKeeperServerBean implements ZooKeeperServerMXBean, ZKMBeanInfo { @Override public long getTxnLogElapsedSyncTime() { return zks.getTxnLogElapsedSyncTime(); } ZooKeeperServerBean(ZooKeeperServer zks); String getClientPort(); String getName(); boolean isHidden(); String getStartTime(); String getVersion(); long getAvgRequestLatency(); long getMaxRequestLatency(); long getMinRequestLatency(); long getOutstandingRequests(); int getTickTime(); void setTickTime(int tickTime); int getMaxClientCnxnsPerHost(); void setMaxClientCnxnsPerHost(int max); int getMinSessionTimeout(); void setMinSessionTimeout(int min); int getMaxSessionTimeout(); void setMaxSessionTimeout(int max); long getDataDirSize(); long getLogDirSize(); long getPacketsReceived(); long getPacketsSent(); long getFsyncThresholdExceedCount(); void resetLatency(); void resetMaxLatency(); void resetFsyncThresholdExceedCount(); void resetStatistics(); long getNumAliveConnections(); @Override String getSecureClientPort(); @Override String getSecureClientAddress(); @Override long getTxnLogElapsedSyncTime(); @Override int getJuteMaxBufferSize(); @Override int getLastClientResponseSize(); @Override int getMinClientResponseSize(); @Override int getMaxClientResponseSize();  }