Search in sources :

Example 1 with RMIServer

use of javax.management.remote.rmi.RMIServer 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 RMIServer

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

the class ImplVersionCommand method main.

public static void main(String[] args) throws Exception {
    // Create RMIJRMPServerImpl
    //
    System.out.println("Create RMIJRMPServerImpl");
    RMIServer server = new RMIJRMPServerImpl(0, null, null, null);
    // Get the JMX Remote impl version from RMIServer
    //
    System.out.println("Get JMX Remote implementation version from RMIServer");
    String full_version = server.getVersion();
    System.out.println("RMIServer.getVersion() = " + full_version);
    String impl_version = full_version.substring(full_version.indexOf("java_runtime_") + "java_runtime_".length());
    // Display JMX Remote impl version and Java Runtime version
    //
    System.out.println("JMX Remote implementation version   = " + impl_version);
    System.out.println("Java Runtime implementation version = " + args[0]);
    //
    if (!impl_version.equals(args[0])) {
        // Test FAILED
        throw new IllegalArgumentException("***FAILED: JMX Remote and Java Runtime versions do NOT match***");
    }
    // Test OK!
    System.out.println("JMX Remote and Java Runtime versions match.");
    System.out.println("Bye! Bye!");
}
Also used : RMIJRMPServerImpl(javax.management.remote.rmi.RMIJRMPServerImpl) RMIServer(javax.management.remote.rmi.RMIServer)

Aggregations

RMIServer (javax.management.remote.rmi.RMIServer)2 RMIConnection (javax.management.remote.rmi.RMIConnection)1 RMIJRMPServerImpl (javax.management.remote.rmi.RMIJRMPServerImpl)1