gpt4 book ai didi

org.apache.helix.monitoring.mbeans.ZkClientMonitor.record()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 09:48:46 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.helix.monitoring.mbeans.ZkClientMonitor.record()方法的一些代码示例,展示了ZkClientMonitor.record()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkClientMonitor.record()方法的具体详情如下:
包路径:org.apache.helix.monitoring.mbeans.ZkClientMonitor
类名称:ZkClientMonitor
方法名:record

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);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com