private <T> T execute(JmxTemplate<T> template) throws OpsMetricsException {
LOG.debug("Connecting to {}:{}", host, port);
JMXConnector connector = null;
try {
JMXServiceURL address = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + host + ":"
+ port + "/jmxrmi");
HashMap<String, String[]> env = getCredentials();
connector = JMXConnectorFactory.connect(address, env);
MBeanServerConnection mbs = connector.getMBeanServerConnection();
return template.execute(mbs);
} catch (Exception e) {
LOG.error("Unabled to execute JMX command", e);
throw new OpsMetricsException(e);
} finally {
close(connector);
}
}
OpsMetrics.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:newrelic-pcf-drain
作者:
评论列表
文章目录