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

lutoff
03.59.2006 16e0eb720faae6548b0903a4ceef18c3f333592a
In the previous implementation, each time we had a configuration change,
the JMX connector **AND** the RMI registry was closed.

With this modification, the RMI registry will be closed only if it's
required, basically, if there is a change port request or if the connector.
2 files modified
42 ■■■■■ changed files
opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java 10 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java 32 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java
@@ -505,7 +505,9 @@
      String finalizeReason, boolean closeConnections)
  {
    assert debugEnter(CLASS_NAME, "finalizeConnectionHandler");
    rmiConnector.finalizeConnectionHandler(closeConnections);
    // We should also close the RMI registry.
    rmiConnector.finalizeConnectionHandler(closeConnections, true);
  }
  /**
@@ -552,7 +554,8 @@
  public void processServerShutdown(String reason)
  {
    assert debugEnter(CLASS_NAME, "processServerShutdown");
    rmiConnector.finalizeConnectionHandler(true);
    //  We should also close the RMI registry.
    rmiConnector.finalizeConnectionHandler(true, true);
  }
@@ -795,7 +798,8 @@
    //
    // Stop the current connector
    // TODO Set Msg
    this.finalizeConnectionHandler("new config", true);
    this.rmiConnector.finalizeConnectionHandler(true,
        (listenPort != newListenPort));
    //
    // set new params and update JMX attributes
opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java
@@ -30,7 +30,6 @@
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.RMISocketFactory;
import java.util.HashMap;
import javax.net.ssl.SSLSocketFactory;
@@ -225,8 +224,7 @@
      if (registry == null)
      {
        rmiSsf = new OpendsRmiServerSocketFactory();
        registry = LocateRegistry.createRegistry(registryPort,
            RMISocketFactory.getDefaultSocketFactory(), rmiSsf);
        registry = LocateRegistry.createRegistry(registryPort, null, rmiSsf);
      }
    }
    catch (RemoteException re)
@@ -421,8 +419,10 @@
   *            Indicates whether any established client connections
   *            associated with the connection handler should also be
   *            closed.
   * @param stopRegistry Indicates if the RMI registry should be stopped
   */
  public void finalizeConnectionHandler(boolean closeConnections)
  public void finalizeConnectionHandler(
      boolean closeConnections, boolean stopRegistry)
  {
    if (closeConnections)
    {
@@ -476,17 +476,21 @@
      assert debugException(CLASS_NAME, "finalizeConnectionHandler", e);
    }
    //
    // Close the socket
    try
    if (stopRegistry)
    {
      rmiSsf.close();
      //
      // Close the socket
      try
      {
        rmiSsf.close();
      }
      catch (IOException e)
      {
        // TODO Log an error message
        assert debugException(CLASS_NAME, "finalizeConnectionHandler", e);
      }
      registry = null;
    }
    catch (IOException e)
    {
      // TODO Log an error message
      assert debugException(CLASS_NAME, "finalizeConnectionHandler", e);
    }
    registry = null;
  }
}