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

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

Introduction

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

Prototype

public synchronized boolean isActive() 

Source Link

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  ww  w  .j a va2 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;
}