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

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

Introduction

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

Prototype

public synchronized void start() throws IOException 

Source Link

Document

Activates the connector server, that is starts listening for client connections.

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;
    }//from   w w w.ja  va 2s . 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;
}