Java 类javax.management.remote.rmi.RMIConnectorServer 实例源码

项目:jdk8u-jdk    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:openjdk-jdk10    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:openjdk9    文件:JMXAgentInterfaceBinding.java   
private void connect() throws IOException {
    System.out.println(
            "JMXConnectorThread: Attempting JMX connection on: "
                    + addr + " on port " + jmxPort);
    JMXServiceURL url;
    try {
        url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"
                + addr + ":" + jmxPort + "/jmxrmi");
    } catch (MalformedURLException e) {
        throw new RuntimeException("Test failed.", e);
    }
    Map<String, Object> env = new HashMap<>();
    if (useSSL) {
        SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory();
        env.put("com.sun.jndi.rmi.factory.socket", csf);
        env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf);
    }
    // connect and immediately close
    JMXConnector c = JMXConnectorFactory.connect(url, env);
    c.close();
    System.out.println("JMXConnectorThread: connection to JMX worked");
    jmxConnectWorked = true;
    checkRmiSocket();
    latch.countDown(); // signal we are done.
}
项目:openjdk9    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:QD    文件:JmxRmi.java   
static JmxConnector init(Properties props) throws IOException {
    Integer port = Integer.decode(props.getProperty(JMXEndpoint.JMX_RMI_PORT_PROPERTY));

    if (!JmxConnectors.isPortAvailable(port))
        return null;

    String name = "com.devexperts.qd.monitoring:type=RmiServer,port=" + port;
    RMIJRMPServerImpl srvImpl = new RMIJRMPServerImpl(port, null, null, null);
    RMIConnectorServer rmiServer = new RMIConnectorServer(
        new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:" + port +  "/jmxrmi"),
        null, srvImpl, ManagementFactory.getPlatformMBeanServer());
    ConnectorImpl connector = new ConnectorImpl(name, rmiServer);
    if (!JmxConnectors.addConnector(port, connector))
        return null; // port is already taken

    LocateRegistry.createRegistry(port);
    connector.setRegistration(Management.registerMBean(rmiServer, null, name));
    rmiServer.start();
    QDLog.log.info("RMI management port is " + port);
    return connector;
}
项目:jdk8u_jdk    文件:JMXAgentInterfaceBinding.java   
private void connect() throws IOException {
    System.out.println(
            "JMXConnectorThread: Attempting JMX connection on: "
                    + addr + " on port " + jmxPort);
    JMXServiceURL url;
    try {
        url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"
                + addr + ":" + jmxPort + "/jmxrmi");
    } catch (MalformedURLException e) {
        throw new RuntimeException("Test failed.", e);
    }
    Map<String, Object> env = new HashMap<>();
    if (useSSL) {
        SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory();
        env.put("com.sun.jndi.rmi.factory.socket", csf);
        env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf);
    }
    // connect and immediately close
    JMXConnector c = JMXConnectorFactory.connect(url, env);
    c.close();
    System.out.println("JMXConnectorThread: connection to JMX worked");
    jmxConnectWorked = true;
    checkRmiSocket();
    latch.countDown(); // signal we are done.
}
项目:jdk8u_jdk    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:lookaside_java-1.8.0-openjdk    文件:JMXAgentInterfaceBinding.java   
private void connect() throws IOException {
    System.out.println(
            "JMXConnectorThread: Attempting JMX connection on: "
                    + addr + " on port " + jmxPort);
    JMXServiceURL url;
    try {
        url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://"
                + addr + ":" + jmxPort + "/jmxrmi");
    } catch (MalformedURLException e) {
        throw new RuntimeException("Test failed.", e);
    }
    Map<String, Object> env = new HashMap<>();
    if (useSSL) {
        SslRMIClientSocketFactory csf = new SslRMIClientSocketFactory();
        env.put("com.sun.jndi.rmi.factory.socket", csf);
        env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf);
    }
    // connect and immediately close
    JMXConnector c = JMXConnectorFactory.connect(url, env);
    c.close();
    System.out.println("JMXConnectorThread: connection to JMX worked");
    jmxConnectWorked = true;
    checkRmiSocket();
    latch.countDown(); // signal we are done.
}
项目:lookaside_java-1.8.0-openjdk    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:infobip-open-jdk-8    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:jdk8u-dev-jdk    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:scylla-tools-java    文件:CassandraDaemon.java   
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());
    }
}
项目:jdk7-jdk    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:openjdk-source-code-learn    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:OLD-OpenJDK8    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:JAVA_UNIT    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:openjdk-jdk7u-jdk    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:openjdk-icedtea7    文件:ConnectorStopDeadlockTest.java   
public static void main(String[] args) throws Exception {
    JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://");
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    RMIJRMPServerImplSub impl = new RMIJRMPServerImplSub();

    System.out.println("Creating connectorServer");
    connectorServer = new RMIConnectorServer(url, null, impl, mbs);
    System.out.println("Starting connectorServer");
    connectorServer.start();
    System.out.println("Making client");
    RMIConnection cc = impl.newClient(null);
    System.out.println("Closing client");
    cc.close();
    if (connectorServer.isActive()) {
        System.out.println("Stopping connectorServer");
        connectorServer.stop();
    }
    if (failure == null)
        System.out.println("TEST PASSED, no deadlock");
    else
        System.out.println("TEST FAILED");
}
项目:OpenJSharp    文件:ServerProvider.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
                                                Map<String,?> environment,
                                                MBeanServer mbeanServer)
        throws IOException {
    if (!serviceURL.getProtocol().equals("rmi")) {
        throw new MalformedURLException("Protocol not rmi: " +
                                        serviceURL.getProtocol());
    }
    return new RMIConnectorServer(serviceURL, environment, mbeanServer);
}
项目:OpenJSharp    文件:ServerProvider.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
                                                Map<String,?> environment,
                                                MBeanServer mbeanServer)
        throws IOException {
    if (!serviceURL.getProtocol().equals("iiop")) {
        throw new MalformedURLException("Protocol not iiop: " +
                                        serviceURL.getProtocol());
    }
    return new RMIConnectorServer(serviceURL, environment, mbeanServer);
}
项目:jmx-prometheus-exporter    文件:RMIConnector.java   
@Override
public @NotNull JMXConnector connect() throws IOException {
  final Map<String, Object> environment = environment();
  if (ssl) {
    environment.put(Context.SECURITY_PROTOCOL, "ssl");
    final SslRMIClientSocketFactory clientSocketFactory = new SslRMIClientSocketFactory();
    environment.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, clientSocketFactory);
    environment.put("com.sun.jndi.rmi.factory.socket", clientSocketFactory);
  }
  final JMXServiceURL address = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://" + address() + "/jmxrmi");
  return JMXConnectorFactory.connect(address, environment);
}
项目:jdk8u-jdk    文件:ServerProvider.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
                                                Map<String,?> environment,
                                                MBeanServer mbeanServer)
        throws IOException {
    if (!serviceURL.getProtocol().equals("rmi")) {
        throw new MalformedURLException("Protocol not rmi: " +
                                        serviceURL.getProtocol());
    }
    return new RMIConnectorServer(serviceURL, environment, mbeanServer);
}
项目:jdk8u-jdk    文件:ServerProvider.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
                                                Map<String,?> environment,
                                                MBeanServer mbeanServer)
        throws IOException {
    if (!serviceURL.getProtocol().equals("iiop")) {
        throw new MalformedURLException("Protocol not iiop: " +
                                        serviceURL.getProtocol());
    }
    return new RMIConnectorServer(serviceURL, environment, mbeanServer);
}
项目:jdk8u-jdk    文件:TargetMBeanTest.java   
private static boolean test(String proto, MBeanServer mbs)
        throws Exception {
    System.out.println("Testing for proto " + proto);

    JMXConnectorServer cs;
    JMXServiceURL url = new JMXServiceURL(proto, null, 0);
    try {
        cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null,
                                                             mbs);
    } catch (MalformedURLException e) {
        System.out.println("System does not recognize URL: " + url +
                           "; ignoring");
        return true;
    }
    cs.start();
    JMXServiceURL addr = cs.getAddress();
    JMXServiceURL rmiurl = new JMXServiceURL("rmi", null, 0);
    JMXConnector client = JMXConnectorFactory.connect(addr);
    MBeanServerConnection mbsc = client.getMBeanServerConnection();
    ObjectName on = new ObjectName("x:proto=" + proto + ",ok=yes");
    mbsc.createMBean(RMIConnectorServer.class.getName(),
                     on,
                     mletName,
                     new Object[] {rmiurl, null},
                     new String[] {JMXServiceURL.class.getName(),
                                   Map.class.getName()});
    System.out.println("Successfully deserialized with " + proto);
    mbsc.unregisterMBean(on);

    client.close();
    cs.stop();
    return true;
}
项目:jdk8u-jdk    文件:JMXConnectorServerProviderImpl.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL url,
                                                Map<String,?> map,
                                                MBeanServer mbeanServer)
    throws IOException {
    final String protocol = url.getProtocol();
    called = true;
    System.out.println("JMXConnectorServerProviderImpl called");
    if(protocol.equals("rmi"))
        return new RMIConnectorServer(url, map, mbeanServer);
    if(protocol.equals("throw-provider-exception"))
        throw new JMXProviderException("I have been asked to throw");

    throw new IllegalArgumentException("UNKNOWN PROTOCOL");
}
项目:openjdk-jdk10    文件:ServerProvider.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
                                                Map<String,?> environment,
                                                MBeanServer mbeanServer)
        throws IOException {
    if (!serviceURL.getProtocol().equals("rmi")) {
        throw new MalformedURLException("Protocol not rmi: " +
                                        serviceURL.getProtocol());
    }
    return new RMIConnectorServer(serviceURL, environment, mbeanServer);
}
项目:openjdk-jdk10    文件:TargetMBeanTest.java   
private static boolean test(String proto, MBeanServer mbs)
        throws Exception {
    System.out.println("Testing for proto " + proto);

    JMXConnectorServer cs;
    JMXServiceURL url = new JMXServiceURL(proto, null, 0);
    try {
        cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null,
                                                             mbs);
    } catch (MalformedURLException e) {
        System.out.println("System does not recognize URL: " + url +
                           "; ignoring");
        return true;
    }
    cs.start();
    JMXServiceURL addr = cs.getAddress();
    JMXServiceURL rmiurl = new JMXServiceURL("rmi", null, 0);
    JMXConnector client = JMXConnectorFactory.connect(addr);
    MBeanServerConnection mbsc = client.getMBeanServerConnection();
    ObjectName on = new ObjectName("x:proto=" + proto + ",ok=yes");
    mbsc.createMBean(RMIConnectorServer.class.getName(),
                     on,
                     mletName,
                     new Object[] {rmiurl, null},
                     new String[] {JMXServiceURL.class.getName(),
                                   Map.class.getName()});
    System.out.println("Successfully deserialized with " + proto);
    mbsc.unregisterMBean(on);

    client.close();
    cs.stop();
    return true;
}
项目:openjdk-jdk10    文件:JMXConnectorServerProviderImpl.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL url,
                                                Map<String,?> map,
                                                MBeanServer mbeanServer)
    throws IOException {
    final String protocol = url.getProtocol();
    called = true;
    System.out.println("JMXConnectorServerProviderImpl called");
    if(protocol.equals("rmi"))
        return new RMIConnectorServer(url, map, mbeanServer);
    if(protocol.equals("throw-provider-exception"))
        throw new JMXProviderException("I have been asked to throw");

    throw new IllegalArgumentException("UNKNOWN PROTOCOL");
}
项目:openjdk9    文件:ServerProvider.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
                                                Map<String,?> environment,
                                                MBeanServer mbeanServer)
        throws IOException {
    if (!serviceURL.getProtocol().equals("rmi")) {
        throw new MalformedURLException("Protocol not rmi: " +
                                        serviceURL.getProtocol());
    }
    return new RMIConnectorServer(serviceURL, environment, mbeanServer);
}
项目:openjdk9    文件:TargetMBeanTest.java   
private static boolean test(String proto, MBeanServer mbs)
        throws Exception {
    System.out.println("Testing for proto " + proto);

    JMXConnectorServer cs;
    JMXServiceURL url = new JMXServiceURL(proto, null, 0);
    try {
        cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null,
                                                             mbs);
    } catch (MalformedURLException e) {
        System.out.println("System does not recognize URL: " + url +
                           "; ignoring");
        return true;
    }
    cs.start();
    JMXServiceURL addr = cs.getAddress();
    JMXServiceURL rmiurl = new JMXServiceURL("rmi", null, 0);
    JMXConnector client = JMXConnectorFactory.connect(addr);
    MBeanServerConnection mbsc = client.getMBeanServerConnection();
    ObjectName on = new ObjectName("x:proto=" + proto + ",ok=yes");
    mbsc.createMBean(RMIConnectorServer.class.getName(),
                     on,
                     mletName,
                     new Object[] {rmiurl, null},
                     new String[] {JMXServiceURL.class.getName(),
                                   Map.class.getName()});
    System.out.println("Successfully deserialized with " + proto);
    mbsc.unregisterMBean(on);

    client.close();
    cs.stop();
    return true;
}
项目:openjdk9    文件:JMXConnectorServerProviderImpl.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL url,
                                                Map<String,?> map,
                                                MBeanServer mbeanServer)
    throws IOException {
    final String protocol = url.getProtocol();
    called = true;
    System.out.println("JMXConnectorServerProviderImpl called");
    if(protocol.equals("rmi"))
        return new RMIConnectorServer(url, map, mbeanServer);
    if(protocol.equals("throw-provider-exception"))
        throw new JMXProviderException("I have been asked to throw");

    throw new IllegalArgumentException("UNKNOWN PROTOCOL");
}
项目:gemfirexd-oss    文件:AdminDUnitTestCase.java   
private JMXConnector createJMXConnector() throws Exception {
  JMXServiceURL url = new JMXServiceURL(this.urlString);
  RMIServerSocketFactory ssf = new MX4JServerSocketFactory(
      true, true, "any", "any", new LocalLogWriter(LogWriterImpl.FINE_LEVEL), new Properties());
  RMIClientSocketFactory csf = new SslRMIClientSocketFactory();

  Map env = new HashMap();
  env.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, ssf);
  env.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, csf);

  return JMXConnectorFactory.connect(url, env);
}
项目:jdk8u_jdk    文件:ServerProvider.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
                                                Map<String,?> environment,
                                                MBeanServer mbeanServer)
        throws IOException {
    if (!serviceURL.getProtocol().equals("rmi")) {
        throw new MalformedURLException("Protocol not rmi: " +
                                        serviceURL.getProtocol());
    }
    return new RMIConnectorServer(serviceURL, environment, mbeanServer);
}
项目:jdk8u_jdk    文件:ServerProvider.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
                                                Map<String,?> environment,
                                                MBeanServer mbeanServer)
        throws IOException {
    if (!serviceURL.getProtocol().equals("iiop")) {
        throw new MalformedURLException("Protocol not iiop: " +
                                        serviceURL.getProtocol());
    }
    return new RMIConnectorServer(serviceURL, environment, mbeanServer);
}
项目:jdk8u_jdk    文件:TargetMBeanTest.java   
private static boolean test(String proto, MBeanServer mbs)
        throws Exception {
    System.out.println("Testing for proto " + proto);

    JMXConnectorServer cs;
    JMXServiceURL url = new JMXServiceURL(proto, null, 0);
    try {
        cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null,
                                                             mbs);
    } catch (MalformedURLException e) {
        System.out.println("System does not recognize URL: " + url +
                           "; ignoring");
        return true;
    }
    cs.start();
    JMXServiceURL addr = cs.getAddress();
    JMXServiceURL rmiurl = new JMXServiceURL("rmi", null, 0);
    JMXConnector client = JMXConnectorFactory.connect(addr);
    MBeanServerConnection mbsc = client.getMBeanServerConnection();
    ObjectName on = new ObjectName("x:proto=" + proto + ",ok=yes");
    mbsc.createMBean(RMIConnectorServer.class.getName(),
                     on,
                     mletName,
                     new Object[] {rmiurl, null},
                     new String[] {JMXServiceURL.class.getName(),
                                   Map.class.getName()});
    System.out.println("Successfully deserialized with " + proto);
    mbsc.unregisterMBean(on);

    client.close();
    cs.stop();
    return true;
}
项目:jdk8u_jdk    文件:JMXConnectorServerProviderImpl.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL url,
                                                Map<String,?> map,
                                                MBeanServer mbeanServer)
    throws IOException {
    final String protocol = url.getProtocol();
    called = true;
    System.out.println("JMXConnectorServerProviderImpl called");
    if(protocol.equals("rmi"))
        return new RMIConnectorServer(url, map, mbeanServer);
    if(protocol.equals("throw-provider-exception"))
        throw new JMXProviderException("I have been asked to throw");

    throw new IllegalArgumentException("UNKNOWN PROTOCOL");
}
项目:lookaside_java-1.8.0-openjdk    文件:ServerProvider.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
                                                Map<String,?> environment,
                                                MBeanServer mbeanServer)
        throws IOException {
    if (!serviceURL.getProtocol().equals("rmi")) {
        throw new MalformedURLException("Protocol not rmi: " +
                                        serviceURL.getProtocol());
    }
    return new RMIConnectorServer(serviceURL, environment, mbeanServer);
}
项目:lookaside_java-1.8.0-openjdk    文件:ServerProvider.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL,
                                                Map<String,?> environment,
                                                MBeanServer mbeanServer)
        throws IOException {
    if (!serviceURL.getProtocol().equals("iiop")) {
        throw new MalformedURLException("Protocol not iiop: " +
                                        serviceURL.getProtocol());
    }
    return new RMIConnectorServer(serviceURL, environment, mbeanServer);
}
项目:lookaside_java-1.8.0-openjdk    文件:TargetMBeanTest.java   
private static boolean test(String proto, MBeanServer mbs)
        throws Exception {
    System.out.println("Testing for proto " + proto);

    JMXConnectorServer cs;
    JMXServiceURL url = new JMXServiceURL(proto, null, 0);
    try {
        cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null,
                                                             mbs);
    } catch (MalformedURLException e) {
        System.out.println("System does not recognize URL: " + url +
                           "; ignoring");
        return true;
    }
    cs.start();
    JMXServiceURL addr = cs.getAddress();
    JMXServiceURL rmiurl = new JMXServiceURL("rmi", null, 0);
    JMXConnector client = JMXConnectorFactory.connect(addr);
    MBeanServerConnection mbsc = client.getMBeanServerConnection();
    ObjectName on = new ObjectName("x:proto=" + proto + ",ok=yes");
    mbsc.createMBean(RMIConnectorServer.class.getName(),
                     on,
                     mletName,
                     new Object[] {rmiurl, null},
                     new String[] {JMXServiceURL.class.getName(),
                                   Map.class.getName()});
    System.out.println("Successfully deserialized with " + proto);
    mbsc.unregisterMBean(on);

    client.close();
    cs.stop();
    return true;
}
项目:lookaside_java-1.8.0-openjdk    文件:JMXConnectorServerProviderImpl.java   
public JMXConnectorServer newJMXConnectorServer(JMXServiceURL url,
                                                Map<String,?> map,
                                                MBeanServer mbeanServer)
    throws IOException {
    final String protocol = url.getProtocol();
    called = true;
    System.out.println("JMXConnectorServerProviderImpl called");
    if(protocol.equals("rmi"))
        return new RMIConnectorServer(url, map, mbeanServer);
    if(protocol.equals("throw-provider-exception"))
        throw new JMXProviderException("I have been asked to throw");

    throw new IllegalArgumentException("UNKNOWN PROTOCOL");
}