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();
}
}
}
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");
}
Aggregations