Example usage for java.rmi.server UnicastRemoteObject unexportObject

List of usage examples for java.rmi.server UnicastRemoteObject unexportObject

Introduction

In this page you can find the example usage for java.rmi.server UnicastRemoteObject unexportObject.

Prototype

public static boolean unexportObject(Remote obj, boolean force) throws java.rmi.NoSuchObjectException 

Source Link

Document

Removes the remote object, obj, from the RMI runtime.

Usage

From source file:uk.co.gidley.jmxmonitor.services.InternalJmx.java

@Override
public void registryDidShutdown() {
    if (jmxConnectorServer != null) {
        logger.debug("Shutting down JMX");
        try {//  w  ww .j ava2 s  .c om
            jmxConnectorServer.stop();
        } catch (IOException e) {
            logger.error("{}", e);
        }
    }
    if (registry != null) {
        logger.debug("Shutting down RMI");
        try {
            UnicastRemoteObject.unexportObject(this.registry, true);
        } catch (NoSuchObjectException e) {
            logger.error("{}", e);
        }
    }

    try {
        MBEAN_SERVER.unregisterMBean(connectorServerName);
    } catch (InstanceNotFoundException e) {
        logger.warn("{}", e);
    } catch (MBeanRegistrationException e) {
        logger.warn("{}", e);
    }

}

From source file:org.wso2.carbon.core.init.JMXServerManager.java

public void stopJmxService() {
    try {//ww w .  ja v  a  2 s.  c  o  m
        if (jmxConnectorServer != null) {
            jmxConnectorServer.stop();
            try {
                UnicastRemoteObject.unexportObject(rmiRegistry, true); // Stop the RMI registry
            } catch (java.rmi.NoSuchObjectException ignored) {
            }
        }
    } catch (Exception e) {
        log.error("Error occurred while stopping JMXConnectorServer", e);
    }
}

From source file:org.openadaptor.util.JVMNeutralMBeanServerFactory.java

/**
 * Stops the JMXConnector server, if it's not null.
 * Only applies to 1.4 instances.//from w  w w .ja v a  2s  . c  o m
 */
public static void shutdown() {
    if (jmxConnectorServer_1_4 != null) {
        try {
            log.info("stopping JMXConnectionServer (jvm 1.4)");
            jmxConnectorServer_1_4.stop();
            if (rmiRegistry != null) {
                log.info("stopping rmi registry");
                UnicastRemoteObject.unexportObject(rmiRegistry, true);
            }
        } catch (IOException ioe) {
            log.warn("Failed to cleanly stop JMXConnectorServer (jvm 1.4)");
        }
    }
}

From source file:xbird.engine.remote.ExchangingRemoteFocusProxy.java

public void close(final boolean force) throws RemoteException {
    if (_closed.compareAndSet(false, true)) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("unexportObject `" + this.toString() + (force ? "' explicitly." : "' by finalizer."));
        }/*www . j  a va2  s  .  c o m*/
        try {
            UnicastRemoteObject.unexportObject(this, force);
        } catch (NoSuchObjectException e) {
            LOG.error(
                    "failed unexportObject `" + this.toString() + (force ? "' explicitly." : "' by finilizer."),
                    e);
            throw e;
        }
        _seq.close(force);
    }
}

From source file:org.jcommon.com.util.jmx.RmiAdptor.java

public void unexportObject() throws NoSuchObjectException {
    if (registry != null)
        UnicastRemoteObject.unexportObject(registry, true);
}

From source file:org.apache.geode.management.internal.ManagementAgent.java

public synchronized void stopAgent() {
    stopHttpService();// w  w  w .  j av  a  2  s.  c o  m

    if (!this.running) {
        return;
    }

    if (logger.isDebugEnabled()) {
        logger.debug("Stopping jmx manager agent");
    }
    try {
        jmxConnectorServer.stop();
        UnicastRemoteObject.unexportObject(registry, true);
    } catch (Exception e) {
        throw new ManagementException(e);
    }

    this.running = false;
}

From source file:xbird.engine.remote.RemoteFocusProxy.java

public void close(final boolean force) throws RemoteException {
    if (_closed.compareAndSet(false, true)) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("unexportObject `" + this.toString() + (force ? "' explicitly." : "' by finalizer."));
        }//from   www . j a  va  2  s. co  m
        try {
            UnicastRemoteObject.unexportObject(this, force);
        } catch (NoSuchObjectException e) {
            LOG.error(
                    "failed unexportObject `" + this.toString() + (force ? "' explicitly." : "' by finilizer."),
                    e);
            throw e;
        }
        _seq.close(force);
        _delegate.closeQuietly();
    }
}

From source file:org.alfresco.reporting.test.TestReporting.java

private static boolean stopRegistry(Registry registry) {
    System.out.println("enter stopRegistry");
    boolean result = false;
    try {//from w  w  w  .j  ava  2  s .c o  m
        result = UnicastRemoteObject.unexportObject(registry, true);
    } catch (NoSuchObjectException e) {
        System.out.println("stopRegistry: RMI registry already stopped.");
        //e.printStackTrace();
    }
    System.out.println("exit stopRegistry: RMI registry stopped: " + result);
    return result;
}

From source file:org.springframework.remoting.rmi.RmiServiceExporter.java

public void destroy() throws RemoteException, NotBoundException {
    logger.info("Unbinding RMI service '" + this.serviceName + "' from registry at port '" + this.registryPort
            + "'");
    Registry registry = LocateRegistry.getRegistry(this.registryPort);
    registry.unbind(this.serviceName);
    UnicastRemoteObject.unexportObject(this.exportedObject, true);
}

From source file:com.continuent.tungsten.common.jmx.JmxManager.java

/**
 * Deallocates the RMI registry.// w  w w  . j  a  v  a 2s  . c o  m
 */
protected void stopRMI() {
    if (rmiRegistry != null) {
        try {
            UnicastRemoteObject.unexportObject(rmiRegistry, true);
        } catch (NoSuchObjectException e) {
            logger.warn("Unexpected error while shutting down RMI registry", e);
        }
        rmiRegistry = null;
    }
}