Example usage for javax.management.remote.rmi RMIConnectorServer RMIConnectorServer

List of usage examples for javax.management.remote.rmi RMIConnectorServer RMIConnectorServer

Introduction

In this page you can find the example usage for javax.management.remote.rmi RMIConnectorServer RMIConnectorServer.

Prototype

public RMIConnectorServer(JMXServiceURL url, Map<String, ?> environment, MBeanServer mbeanServer)
        throws IOException 

Source Link

Document

Makes an RMIConnectorServer for the given MBean server.

Usage

From source file:org.nuxeo.runtime.management.ServerLocatorService.java

protected MBeanServer doCreateServer(final ServerLocatorDescriptor descriptor) {
    MBeanServer server = MBeanServerFactory.createMBeanServer();
    JMXServiceURL url = doFormatServerURL(descriptor);
    if (!descriptor.remote) {
        return server;
    }/* w  w w  .  j a  v a  2 s .c o m*/
    final RMIConnectorServer connector;
    try {
        connector = new RMIConnectorServer(url, null, server);
    } catch (IOException e) {
        throw new ManagementRuntimeException("Cannot start connector for " + descriptor.domainName, e);
    }
    try {
        connector.start();
    } catch (IOException e) {
        try {
            LocateRegistry.createRegistry(descriptor.rmiPort);
        } catch (RemoteException e2) {
            throw new ManagementRuntimeException("Cannot start RMI connector for " + descriptor.domainName, e);
        }
        try {
            connector.start();
        } catch (IOException e2) {
            throw new ManagementRuntimeException("Cannot start RMI connector for " + descriptor.domainName, e2);
        }
    }
    assert connector.isActive();
    log.info("Started a mbean server : " + url);
    return server;
}