mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

lutoff
19.58.2006 e5bf2a8578b2316d866a45f93b259570c687b10b
opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java
@@ -26,9 +26,13 @@
 */
package org.opends.server.protocols.jmx;
import java.io.IOException;
import java.rmi.NoSuchObjectException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.RMISocketFactory;
import java.rmi.server.UnicastRemoteObject;
import java.util.HashMap;
import javax.net.ssl.SSLSocketFactory;
@@ -116,6 +120,16 @@
   */
  private RmiAuthenticator rmiAuthenticator;
  /**
   * The reference to the created RMI registry.
   */
  private Registry registry = null;
  /**
   * The Underlying Socket factory.
   */
  OpendsRmiServerSocketFactory rmiSsf;
  // ===================================================================
  // CONSTRUCTOR
  // ===================================================================
@@ -210,8 +224,12 @@
    {
      //
      // TODO Not yet implemented: If the host has several interfaces
      LocateRegistry.createRegistry(registryPort);
      if (registry == null)
      {
        rmiSsf = new OpendsRmiServerSocketFactory();
        registry = LocateRegistry.createRegistry(registryPort,
            RMISocketFactory.getDefaultSocketFactory(), rmiSsf);
      }
    }
    catch (RemoteException re)
    {
@@ -232,6 +250,7 @@
        //
        // 'ping' the registry
        reg.list();
        registry = reg;
      }
      catch (Exception e)
      {
@@ -455,7 +474,34 @@
    }
    catch (Exception e)
    {
      // TODO Log an error message
      assert debugException(CLASS_NAME, "finalizeConnectionHandler", e);
    }
    //
    // Stop the RMI registry
    try
    {
      UnicastRemoteObject.unexportObject(registry, true);
    }
    catch (NoSuchObjectException e)
    {
      // TODO Log an error message
      assert debugException(CLASS_NAME, "finalizeConnectionHandler", e);
    }
    registry = null;
    //
    // Close the socket
    try
    {
      rmiSsf.close();
    }
    catch (IOException e)
    {
      // TODO Log an error message
      assert debugException(CLASS_NAME, "finalizeConnectionHandler", e);
    }
  }
}