当前位置: 首页>>代码示例>>Java>>正文


Java JMXMPConnectorServer类代码示例

本文整理汇总了Java中javax.management.remote.jmxmp.JMXMPConnectorServer的典型用法代码示例。如果您正苦于以下问题:Java JMXMPConnectorServer类的具体用法?Java JMXMPConnectorServer怎么用?Java JMXMPConnectorServer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JMXMPConnectorServer类属于javax.management.remote.jmxmp包,在下文中一共展示了JMXMPConnectorServer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import javax.management.remote.jmxmp.JMXMPConnectorServer; //导入依赖的package包/类
@Override
public Void run() {
	Runtime.getRuntime().addShutdownHook(new Thread(){
		public void run() {
			if(!servers.isEmpty()) {
				SimpleLogger.log("Shutting down JMXMP Connector Servers");
				for(final JMXMPConnectorServer server: servers) {
					AccessController.doPrivileged(new PrivilegedAction<Void>() {
						@Override
						public Void run() {
							try { server.stop(); } catch (Exception x) {/* No Op */}
							return null;
						}
					});
					
				}
				servers.clear();
			}
		}
	});
	return null;
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:23,代码来源:InstallCommandProcessor.java

示例2: testJMXMPTunnel

import javax.management.remote.jmxmp.JMXMPConnectorServer; //导入依赖的package包/类
/**
 * Tests loading an array of SSHConnections from JSON and establishing a basic connection
 * @throws Exception thrown on any error
 */
@SuppressWarnings("static-method")
@Test
public void testJMXMPTunnel() throws Exception {
	System.clearProperty(SSHD_PORT_PROP);
	final ApacheSSHDServer sshdServer = ApacheSSHDServer.getInstance();		
	final int[] ports = setLocalPorts();
	System.setProperty(SSHD_PORT_PROP, "" + sshdServer.getPort());
	final JMXMPConnectorServer jmxmp = JMXHelper.fireUpJMXMPServer(0);
	final int remotePort = jmxmp.getAddress().getPort();
	final String agentId = JMXHelper.getAgentId();
	log("Actual Agent ID: [" + agentId + "]");
	try {			
		final URL url = SSHConnectionTest.class.getClassLoader().getResource(TEST_JSON);
		final SSHConnection[] connections = SSHTunnelManager.parseConnections(url);
		log(Arrays.deepToString(connections));
		for(int i = 0; i < connections.length; i++) {
			connections[i].authenticate();
			LocalPortForwarder lpf = (LocalPortForwarder)PrivateAccessor.invoke(connections[i], "createPortForward", new Object[]{0, "localhost", remotePort}, int.class, String.class, int.class);
			final int localPort = lpf.getLocalPort();
			final JMXConnector jmxConnector = JMXHelper.getJMXConnection("service:jmx:jmxmp://localhost:" + localPort, true, null);
			final MBeanServerConnection server = jmxConnector.getMBeanServerConnection();
			final String readAgentId = JMXHelper.getAgentId(server);
			log("Agent ID: for [" + connections[i] + "] : [" + agentId + "]");
			Assert.assertEquals("Mismatch on expected agent ids", agentId, readAgentId);
			jmxConnector.close();
		}
	} finally {
		jmxmp.stop();
		sshdServer.stop(true);
		System.clearProperty(SSHD_PORT_PROP);
	}
}
 
开发者ID:nickman,项目名称:HeliosStreams,代码行数:37,代码来源:SSHConnectionTest.java

示例3: testJMXMPProfiles

import javax.management.remote.jmxmp.JMXMPConnectorServer; //导入依赖的package包/类
public Result testJMXMPProfiles() throws Exception {

        log.info("          ");
        log.info("starat test JMXMPProfiles");
        String[] profiles = { "JMXMP", "SASL", "TLS" };
        for (int i = 0; i < profiles.length; i++) {
            log.info("Create mbean server");
            MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();

            JMXServiceURL url = new JMXServiceURL("service:jmx:jmxmp://");
            log.info("Create JMX Service URL - " + url);
            log.info("Create enviroment with profiles - " + profiles[i] );
            HashMap enviroment = new HashMap();
            enviroment.put("jmx.remote.profiles", profiles[i]);
            // Create a JMXConnectorServer
            log.info("Create JMXMPConnectorServer");
            JMXMPConnectorServer server = new JMXMPConnectorServer(url,
                    enviroment, mbeanServer);
            server.start();
            log.info("Create JMXMPConnectorClient");
            JMXMPConnector client = new JMXMPConnector(url, enviroment);
            
            server.stop();

        }
        return result();
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:28,代码来源:JMXRemoteProfilesTest.java


注:本文中的javax.management.remote.jmxmp.JMXMPConnectorServer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。