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

Ludovic Poitou
09.20.2014 93962e064794511b2ab9980c88e143424251a9f2
Frontport fix for OPENDJ-1269.
2 files modified
71 ■■■■ changed files
opendj3-server-dev/src/server/org/opends/server/protocols/jmx/JmxClientConnection.java 9 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java 62 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/protocols/jmx/JmxClientConnection.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2013 ForgeRock AS
 *      Portions Copyright 2011-2014 ForgeRock AS
 */
package org.opends.server.protocols.jmx;
@@ -137,7 +137,6 @@
  {
    JMXConnectionNotification jcn ;
    //
    // We don't have the expected notification
    if ( ! (notif instanceof JMXConnectionNotification))
    {
@@ -148,7 +147,6 @@
      jcn = (JMXConnectionNotification) notif ;
    }
    //
    // The only handled notifications are CLOSED and FAILED
    if ((!jcn.getType().equals(JMXConnectionNotification.CLOSED))
        && (!jcn.getType().equals(JMXConnectionNotification.FAILED)))
@@ -156,14 +154,12 @@
      return;
    }
    //
    // Check if the closed connection corresponds to the current connection
    if (!(jcn.getConnectionId().equals(jmxConnectionID)))
    {
      return;
    }
    //
    // Ok, we can perform the unbind: call finalize
    disconnect(DisconnectReason.CLIENT_DISCONNECT, false, null);
  }
@@ -967,10 +963,9 @@
      return;
    }
    disconnectStarted = true ;
    jmxConnectionHandler.unregisterClientConnection(this);
    finalizeConnectionInternal();
    // unbind the underlying connection
    try
    {
opendj3-server-dev/src/server/org/opends/server/protocols/jmx/JmxConnectionHandler.java
@@ -22,19 +22,19 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions copyright 2013 ForgeRock AS
 *      Portions copyright 2013-2014 ForgeRock AS
 */
package org.opends.server.protocols.jmx;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import org.opends.messages.Message;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.server.ConnectionHandlerCfg;
import org.opends.server.admin.std.server.JMXConnectionHandlerCfg;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.ConnectionHandler;
import org.opends.server.api.ServerShutdownListener;
@@ -57,12 +57,12 @@
 */
public final class JmxConnectionHandler extends
    ConnectionHandler<JMXConnectionHandlerCfg> implements
    ServerShutdownListener, AlertGenerator,
    ServerShutdownListener,
    ConfigurationChangeListener<JMXConnectionHandlerCfg> {
  /**
   * Key that may be placed into a JMX connection environment map to
   * provide a custom <code>javax.net.ssl.TrustManager</code> array
   * provide a custom {@code javax.net.ssl.TrustManager} array
   * for a connection.
   */
  public static final String TRUST_MANAGER_ARRAY_KEY =
@@ -73,7 +73,7 @@
    "org.opends.server.protocols.jmx.JMXConnectionHandler";
  /** The list of active client connection. */
  private List<ClientConnection> connectionList;
  private final List<ClientConnection> connectionList;
  /** The current configuration state. */
  private JMXConnectionHandlerCfg currentConfig;
@@ -88,7 +88,7 @@
  private String protocol;
  /** The set of listeners for this connection handler. */
  private List<HostPort> listeners = new LinkedList<HostPort>();
  private final List<HostPort> listeners = new LinkedList<HostPort>();
  /**
   * Creates a new instance of this JMX connection handler. It must be
@@ -97,7 +97,7 @@
  public JmxConnectionHandler() {
    super("JMX Connection Handler Thread");
    this.connectionList = new LinkedList<ClientConnection>();
    this.connectionList = new CopyOnWriteArrayList<ClientConnection>();
  }
@@ -110,7 +110,7 @@
      JMXConnectionHandlerCfg config) {
    // Create variables to include in the response.
    ResultCode resultCode = ResultCode.SUCCESS;
    List<Message> messages = new ArrayList<Message>();
    final List<Message> messages = new ArrayList<Message>();
    // Determine whether or not the RMI connection needs restarting.
    boolean rmiConnectorRestart = false;
@@ -193,40 +193,6 @@
  }
  /**
   * Retrieves information about the set of alerts that this generator
   * may produce. The map returned should be between the notification
   * type for a particular notification and the human-readable
   * description for that notification. This alert generator must not
   * generate any alerts with types that are not contained in this
   * list.
   *
   * @return Information about the set of alerts that this generator
   *         may produce.
   */
  @Override
  public Map<String, String> getAlerts()
  {
    return new LinkedHashMap<String, String>();
  }
  /**
   * Retrieves the fully-qualified name of the Java class for this
   * alert generator implementation.
   *
   * @return The fully-qualified name of the Java class for this alert
   *         generator implementation.
   */
  @Override
  public String getClassName() {
    return CLASS_NAME;
  }
  /**
   * Retrieves the set of active client connections that have been
   * established through this connection handler.
@@ -335,7 +301,7 @@
    // Configuration is ok.
    currentConfig = config;
    List<Message> reasons = new LinkedList<Message>();
    final List<Message> reasons = new LinkedList<Message>();
    if (!isPortConfigurationAcceptable(String.valueOf(config.dn()),
        config.getListenPort(), reasons))
    {
@@ -497,6 +463,16 @@
  }
  /**
   * Unregisters a client connection from this JMX connection handler.
   *
   * @param connection
   *          The client connection.
   */
  public void unregisterClientConnection(ClientConnection connection) {
    connectionList.remove(connection);
  }
  /**
   * {@inheritDoc}