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

abobrov
14.49.2008 415750c42075f9ceb01abbb2f58eefb5191ab06a
- followup to [Issue 2877] : Issue with creation of connection handler:
fix various dynamic re/configuration issues.


3 files modified
85 ■■■■■ changed files
opends/src/server/org/opends/server/core/ConnectionHandlerConfigManager.java 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java 43 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java 36 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/ConnectionHandlerConfigManager.java
@@ -252,6 +252,7 @@
    ConnectionHandler connectionHandler = connectionHandlers.get(dn);
    if (connectionHandler != null) {
      DirectoryServer.deregisterConnectionHandler(connectionHandler);
      connectionHandlers.remove(dn);
      connectionHandler.finalizeConnectionHandler(
              INFO_CONNHANDLER_CLOSED_BY_DELETE.get(),
@@ -443,8 +444,11 @@
    ConnectionHandler connectionHandler = null;
    Class<? extends ConnectionHandler> theClass;
    try {
      connectionHandler = connectionHandlers.get(config.dn());
      theClass = pd.loadClass(className, ConnectionHandler.class);
      connectionHandler = theClass.newInstance();
      if (connectionHandler == null) {
        connectionHandler = theClass.newInstance();
      }
    } catch (Exception e) {
      if (debugEnabled())
      {
opends/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java
@@ -138,8 +138,12 @@
      rmiConnectorRestart = true;
    }
    if (!currentConfig.getSSLCertNickname().equals(
        config.getSSLCertNickname())) {
    if (((currentConfig.getSSLCertNickname() != null) &&
          !currentConfig.getSSLCertNickname().equals(
          config.getSSLCertNickname())) ||
        ((config.getSSLCertNickname() != null) &&
          !config.getSSLCertNickname().equals(
          currentConfig.getSSLCertNickname()))) {
      rmiConnectorRestart = true;
    }
@@ -402,25 +406,26 @@
  {
    JMXConnectionHandlerCfg config = (JMXConnectionHandlerCfg) configuration;
    // Attempt to bind to the listen port to verify whether the connection
    // handler will be able to start.
    try
    {
      if (StaticUtils.isAddressInUse(
        new InetSocketAddress(config.getListenPort()).getAddress(),
        config.getListenPort(), true)) {
        throw new IOException(
          ERR_CONNHANDLER_ADDRESS_INUSE.get().toString());
    if ((currentConfig == null) ||
        (!currentConfig.isEnabled() && config.isEnabled()) ||
        (currentConfig.getListenPort() != config.getListenPort())) {
      // Attempt to bind to the listen port to verify whether the connection
      // handler will be able to start.
      try {
        if (StaticUtils.isAddressInUse(
          new InetSocketAddress(config.getListenPort()).getAddress(),
          config.getListenPort(), true)) {
          throw new IOException(
            ERR_CONNHANDLER_ADDRESS_INUSE.get().toString());
        }
      } catch (Exception e) {
        Message message = ERR_JMX_CONNHANDLER_CANNOT_BIND.get(
          String.valueOf(config.dn()), config.getListenPort(),
          getExceptionMessage(e));
        unacceptableReasons.add(message);
        return false;
      }
    }
    catch (Exception e)
    {
      Message message = ERR_JMX_CONNHANDLER_CANNOT_BIND.
          get(String.valueOf(config.dn()), config.getListenPort(),
              getExceptionMessage(e));
      unacceptableReasons.add(message);
      return false;
    }
    return isConfigurationChangeAcceptable(config, unacceptableReasons);
  }
opends/src/server/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
@@ -758,26 +758,26 @@
    // Attempt to bind to the listen port on all configured addresses to
    // verify whether the connection handler will be able to start.
    listenPort = config.getListenPort();
    listenAddresses = config.getListenAddress();
    allowReuseAddress = config.isAllowTCPReuseAddress();
    if ((currentConfig == null) ||
      (!currentConfig.isEnabled() && config.isEnabled())) {
      for (InetAddress a : config.getListenAddress()) {
        try {
          if (StaticUtils.isAddressInUse(a, config.getListenPort(),
            config.isAllowTCPReuseAddress())) {
            throw new IOException(
              ERR_CONNHANDLER_ADDRESS_INUSE.get().toString());
          }
        } catch (IOException e) {
          if (debugEnabled()) {
            TRACER.debugCaught(DebugLogLevel.ERROR, e);
          }
    for (InetAddress a : listenAddresses) {
      try {
        if (StaticUtils.isAddressInUse(a, listenPort, allowReuseAddress)) {
          throw new IOException(
            ERR_CONNHANDLER_ADDRESS_INUSE.get().toString());
          Message message = ERR_LDAP_CONNHANDLER_CANNOT_BIND.get(
            String.valueOf(config.dn()), a.getHostAddress(),
            config.getListenPort(), getExceptionMessage(e));
          unacceptableReasons.add(message);
          return false;
        }
      } catch (IOException e) {
        if (debugEnabled()) {
          TRACER.debugCaught(DebugLogLevel.ERROR, e);
        }
        Message message = ERR_LDAP_CONNHANDLER_CANNOT_BIND.get(
          String.valueOf(config.dn()), a.getHostAddress(),
          listenPort, getExceptionMessage(e));
        unacceptableReasons.add(message);
        return false;
      }
    }