本文整理匯總了Java中javax.management.remote.JMXConnectorServer.toJMXConnector方法的典型用法代碼示例。如果您正苦於以下問題:Java JMXConnectorServer.toJMXConnector方法的具體用法?Java JMXConnectorServer.toJMXConnector怎麽用?Java JMXConnectorServer.toJMXConnector使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.management.remote.JMXConnectorServer
的用法示例。
在下文中一共展示了JMXConnectorServer.toJMXConnector方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: jmxConnectorServerFactoryTests
import javax.management.remote.JMXConnectorServer; //導入方法依賴的package包/類
private int jmxConnectorServerFactoryTests() {
int errorCount = 0;
echo("");
echo(dashedMessage("Run JMXConnectorServerFactory Tests"));
for (int i = 0; i < maps.length - 1; i++) {
echo("\n>>> JMXConnectorServerFactory Test [" + i + "]");
try {
echo("\tMap = " + maps[i]);
echo("\tCreate the MBean server");
MBeanServer mbs = MBeanServerFactory.createMBeanServer();
echo("\tCreate the RMI connector server");
JMXServiceURL url =
new JMXServiceURL("service:jmx:rmi:///jndi/rmi://:" +
port + "/JMXConnectorServerFactory" + i);
JMXConnectorServer jmxcs =
JMXConnectorServerFactory.newJMXConnectorServer(url,
maps[i],
mbs);
echo("\tStart the RMI connector server");
jmxcs.start();
echo("\tCall RMIConnectorServer.toJMXConnector(Map)");
jmxcs.toJMXConnector(maps[i]);
echo("\tStop the RMI connector server");
jmxcs.stop();
echo("\tTest [" + i + "] PASSED!");
} catch (Exception e) {
errorCount++;
echo("\tTest [" + i + "] FAILED!");
e.printStackTrace(System.out);
}
}
if (errorCount == 0) {
echo("");
echo(dashedMessage("JMXConnectorServerFactory Tests PASSED!"));
} else {
echo("");
echo(dashedMessage("JMXConnectorServerFactory Tests FAILED!"));
}
return errorCount;
}