本文整理了Java中org.apache.helix.monitoring.mbeans.ZkClientMonitor.record()
方法的一些代码示例,展示了ZkClientMonitor.record()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkClientMonitor.record()
方法的具体详情如下:
包路径:org.apache.helix.monitoring.mbeans.ZkClientMonitor
类名称:ZkClientMonitor
方法名:record
暂无
代码示例来源:origin: apache/helix
private void record(String path, byte[] data, long startTimeMilliSec, ZkClientMonitor.AccessType accessType) {
if (_monitor != null) {
int dataSize = (data != null) ? data.length : 0;
_monitor.record(path, dataSize, startTimeMilliSec, accessType);
}
}
代码示例来源:origin: apache/helix
public void recordFailure(String path, AccessType accessType) {
switch (accessType) {
case READ:
record(path, 0, 0, true, true);
return;
case WRITE:
record(path, 0, 0, true, false);
return;
default:
return;
}
}
代码示例来源:origin: org.apache.helix/helix-core
public void recordFailure(String path, AccessType accessType) {
switch (accessType) {
case READ:
record(path, 0, 0, true, true);
return;
case WRITE:
record(path, 0, 0, true, false);
return;
default:
return;
}
}
}
代码示例来源:origin: org.apache.helix/helix-core
private void record(String path, byte[] data, long startTimeMilliSec, ZkClientMonitor.AccessType accessType) {
if (_monitor != null) {
int dataSize = (data != null) ? data.length : 0;
_monitor.record(path, dataSize, startTimeMilliSec, accessType);
}
}
代码示例来源:origin: apache/helix
public void record(String path, int dataSize, long startTimeMilliSec, AccessType accessType) {
switch (accessType) {
case READ:
record(path, dataSize, System.currentTimeMillis() - startTimeMilliSec, false, true);
return;
case WRITE:
record(path, dataSize, System.currentTimeMillis() - startTimeMilliSec, false, false);
return;
default:
return;
}
}
代码示例来源:origin: org.apache.helix/helix-core
public void record(String path, int dataSize, long startTimeMilliSec, AccessType accessType) {
switch (accessType) {
case READ:
record(path, dataSize, System.currentTimeMillis() - startTimeMilliSec, false, true);
return;
case WRITE:
record(path, dataSize, System.currentTimeMillis() - startTimeMilliSec, false, false);
return;
default:
return;
}
}
代码示例来源:origin: apache/helix
public void callback(int rc, String path, Object ctx) {
if (rc != 0 && LOG.isDebugEnabled()) {
LOG.debug(this + ", rc:" + Code.get(rc) + ", path: " + path);
}
if (ctx != null && ctx instanceof ZkAsyncCallContext) {
ZkAsyncCallContext zkCtx = (ZkAsyncCallContext) ctx;
if (zkCtx._monitor != null) {
if (zkCtx._isRead) {
zkCtx._monitor.record(path, zkCtx._bytes, zkCtx._startTimeMilliSec,
ZkClientMonitor.AccessType.READ);
} else {
zkCtx._monitor.record(path, zkCtx._bytes, zkCtx._startTimeMilliSec,
ZkClientMonitor.AccessType.WRITE);
}
}
}
_rc = rc;
handle();
synchronized (_lock) {
_lock.set(true);
_lock.notify();
}
}
代码示例来源:origin: org.apache.helix/helix-core
public void callback(int rc, String path, Object ctx) {
if (rc != 0 && LOG.isDebugEnabled()) {
LOG.debug(this + ", rc:" + Code.get(rc) + ", path: " + path);
}
if (ctx != null && ctx instanceof ZkAsyncCallContext) {
ZkAsyncCallContext zkCtx = (ZkAsyncCallContext) ctx;
if (zkCtx._monitor != null) {
if (zkCtx._isRead) {
zkCtx._monitor.record(path, zkCtx._bytes, zkCtx._startTimeMilliSec,
ZkClientMonitor.AccessType.READ);
} else {
zkCtx._monitor.record(path, zkCtx._bytes, zkCtx._startTimeMilliSec,
ZkClientMonitor.AccessType.WRITE);
}
}
}
_rc = rc;
handle();
synchronized (_lock) {
_lock.set(true);
_lock.notify();
}
}
代码示例来源:origin: apache/helix
monitor.record("TEST/IDEALSTATES/myResource", 0, System.currentTimeMillis() - 10,
ZkClientMonitor.AccessType.READ);
Assert.assertEquals((long) _beanServer.getAttribute(rootName, "ReadCounter"), 1);
Assert.assertEquals((long) _beanServer.getAttribute(idealStateName, "ReadCounter"), 1);
Assert.assertTrue((long) _beanServer.getAttribute(rootName, "ReadLatencyGauge.Max") >= 10);
monitor.record("TEST/INSTANCES/testDB0", 0, System.currentTimeMillis() - 15,
ZkClientMonitor.AccessType.READ);
Assert.assertEquals((long) _beanServer.getAttribute(rootName, "ReadCounter"), 2);
Assert.assertTrue((long) _beanServer.getAttribute(rootName, "ReadTotalLatencyCounter") >= 25);
monitor.record("TEST/INSTANCES/node_1/CURRENTSTATES/session_1/Resource", 5,
System.currentTimeMillis() - 10, ZkClientMonitor.AccessType.WRITE);
Assert.assertEquals((long) _beanServer.getAttribute(rootName, "WriteCounter"), 1);
内容来源于网络,如有侵权,请联系作者删除!