本文整理了Java中org.apache.helix.monitoring.mbeans.ZkClientMonitor.<init>()
方法的一些代码示例,展示了ZkClientMonitor.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkClientMonitor.<init>()
方法的具体详情如下:
包路径:org.apache.helix.monitoring.mbeans.ZkClientMonitor
类名称:ZkClientMonitor
方法名:<init>
暂无
代码示例来源:origin: apache/helix
protected ZkClient(IZkConnection zkConnection, int connectionTimeout, long operationRetryTimeout,
PathBasedZkSerializer zkSerializer, String monitorType, String monitorKey,
String monitorInstanceName, boolean monitorRootPathOnly) {
if (zkConnection == null) {
throw new NullPointerException("Zookeeper connection is null!");
}
_connection = zkConnection;
_pathBasedZkSerializer = zkSerializer;
_operationRetryTimeoutInMillis = operationRetryTimeout;
connect(connectionTimeout, this);
// initiate monitor
try {
if (monitorKey != null && !monitorKey.isEmpty() && monitorType != null && !monitorType
.isEmpty()) {
_monitor =
new ZkClientMonitor(monitorType, monitorKey, monitorInstanceName, monitorRootPathOnly,
_eventThread);
_monitor.register();
} else {
LOG.info("ZkClient monitor key or type is not provided. Skip monitoring.");
}
} catch (JMException e) {
LOG.error("Error in creating ZkClientMonitor", e);
}
}
代码示例来源:origin: org.apache.helix/helix-core
protected ZkClient(IZkConnection zkConnection, int connectionTimeout, long operationRetryTimeout,
PathBasedZkSerializer zkSerializer, String monitorType, String monitorKey,
String monitorInstanceName, boolean monitorRootPathOnly) {
if (zkConnection == null) {
throw new NullPointerException("Zookeeper connection is null!");
}
_connection = zkConnection;
_pathBasedZkSerializer = zkSerializer;
_operationRetryTimeoutInMillis = operationRetryTimeout;
connect(connectionTimeout, this);
// initiate monitor
try {
if (monitorKey != null && !monitorKey.isEmpty() && monitorType != null && !monitorType
.isEmpty()) {
_monitor =
new ZkClientMonitor(monitorType, monitorKey, monitorInstanceName, monitorRootPathOnly);
_monitor.setZkEventThread(_eventThread);
} else {
LOG.info("ZkClient monitor key or type is not provided. Skip monitoring.");
}
} catch (JMException e) {
LOG.error("Error in creating ZkClientMonitor", e);
}
}
代码示例来源:origin: apache/helix
@Test
public void testMBeanRegisteration() throws JMException {
final String TEST_TAG_1 = "test_tag_1";
final String TEST_KEY_1 = "test_key_1";
ZkClientMonitor monitor = new ZkClientMonitor(TEST_TAG_1, TEST_KEY_1, null, true, null);
Assert.assertFalse(_beanServer.isRegistered(buildObjectName(TEST_TAG_1, TEST_KEY_1, null)));
monitor.register();
Assert.assertTrue(_beanServer.isRegistered(buildObjectName(TEST_TAG_1, TEST_KEY_1, null)));
// no per-path monitor items created since "monitorRootPathOnly" = true
Assert.assertFalse(_beanServer.isRegistered(
buildPathMonitorObjectName(TEST_TAG_1, TEST_KEY_1, null,
ZkClientPathMonitor.PredefinedPath.IdealStates.name())));
ZkClientMonitor monitorDuplicate = new ZkClientMonitor(TEST_TAG_1, TEST_KEY_1, null, true, null);
monitorDuplicate.register();
Assert.assertTrue(_beanServer.isRegistered(buildObjectName(TEST_TAG_1, TEST_KEY_1, null, 1)));
monitor.unregister();
monitorDuplicate.unregister();
Assert.assertFalse(_beanServer.isRegistered(buildObjectName(TEST_TAG_1, TEST_KEY_1, null)));
Assert.assertFalse(_beanServer.isRegistered(buildObjectName(TEST_TAG_1, TEST_KEY_1, null, 1)));
}
代码示例来源:origin: apache/helix
final String TEST_INSTANCE = "test_instance_3";
ZkClientMonitor monitor = new ZkClientMonitor(TEST_TAG, TEST_KEY, TEST_INSTANCE, false, null);
monitor.register();
内容来源于网络,如有侵权,请联系作者删除!