private void maybeInitJmx()
{
if (System.getProperty("com.sun.management.jmxremote.port") != null)
return;
String jmxPort = System.getProperty("cassandra.jmx.local.port");
if (jmxPort == null)
return;
System.setProperty("java.rmi.server.hostname", InetAddress.getLoopbackAddress().getHostAddress());
RMIServerSocketFactory serverFactory = new RMIServerSocketFactoryImpl();
Map<String, ?> env = Collections.singletonMap(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, serverFactory);
try
{
LocateRegistry.createRegistry(Integer.valueOf(jmxPort), null, serverFactory);
JMXServiceURL url = new JMXServiceURL(String.format("service:jmx:rmi://localhost/jndi/rmi://localhost:%s/jmxrmi", jmxPort));
jmxServer = new RMIConnectorServer(url, env, ManagementFactory.getPlatformMBeanServer());
jmxServer.start();
}
catch (IOException e)
{
exitOrFail(1, e.getMessage(), e.getCause());
}
}
CassandraDaemon.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:scylla-tools-java
作者:
评论列表
文章目录