Search in sources :

Example 1 with RMIConnection

use of javax.management.remote.rmi.RMIConnection in project wildfly by wildfly.

the class ConnectedBean method getMBeanCountFromJNDI.

public int getMBeanCountFromJNDI(String rmiServerJndiName) throws Exception {
    final RMIServer rmiServer = InitialContext.doLookup(rmiServerJndiName);
    final RMIConnection rmiConnection = rmiServer.newClient(null);
    try {
        return rmiConnection.getMBeanCount(null);
    } finally {
        if (rmiConnection != null) {
            rmiConnection.close();
        }
    }
}
Also used : RMIServer(javax.management.remote.rmi.RMIServer) RMIConnection(javax.management.remote.rmi.RMIConnection)

Example 2 with RMIConnection

use of javax.management.remote.rmi.RMIConnection in project jdk8u_jdk by JetBrains.

the class ConnectorStopDeadlockTest method main.

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");
}
Also used : JMXServiceURL(javax.management.remote.JMXServiceURL) RMIConnectorServer(javax.management.remote.rmi.RMIConnectorServer) RMIConnection(javax.management.remote.rmi.RMIConnection) MBeanServer(javax.management.MBeanServer)

Aggregations

RMIConnection (javax.management.remote.rmi.RMIConnection)2 MBeanServer (javax.management.MBeanServer)1 JMXServiceURL (javax.management.remote.JMXServiceURL)1 RMIConnectorServer (javax.management.remote.rmi.RMIConnectorServer)1 RMIServer (javax.management.remote.rmi.RMIServer)1