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

Jean-Noel Rouvignac
21.43.2013 440373baeea17544f6d440d6120d3d2a055234fa
OPENDJ-808 Implement a simple commons REST based HTTP connection handler 

ConcurrentHashMap does not accept putting in null values, so I will put in the key itself (It is redundant, but this is not a problem here.)

HTTPConnectionHandler.java:
clientConnections changed from Map<ClientConnection, Void> to Map<ClientConnection, ClientConnection>.

CollectClientConnectionsFilter.java:
Consequence of the change to HTTPConnectionHandler.
Use the key to put in the value.
2 files modified
14 ■■■■ changed files
opends/src/server/org/opends/server/protocols/http/CollectClientConnectionsFilter.java 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/http/HTTPConnectionHandler.java 8 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/http/CollectClientConnectionsFilter.java
@@ -61,7 +61,7 @@
  /** The connection handler that created this servlet filter. */
  private HTTPConnectionHandler connectionHandler;
  private final Map<ClientConnection, Void> clientConnections;
  private final Map<ClientConnection, ClientConnection> clientConnections;
  /**
   * Constructs a new instance of this class.
@@ -73,7 +73,7 @@
   */
  public CollectClientConnectionsFilter(
      HTTPConnectionHandler connectionHandler,
      Map<ClientConnection, Void> clientConnections)
      Map<ClientConnection, ClientConnection> clientConnections)
  {
    this.connectionHandler = connectionHandler;
    this.clientConnections = clientConnections;
@@ -93,7 +93,7 @@
  {
    final ClientConnection clientConnection =
        new HTTPClientConnection(this.connectionHandler, request);
    this.clientConnections.put(clientConnection, null);
    this.clientConnections.put(clientConnection, clientConnection);
    try
    {
      String ipAddress = request.getRemoteAddr();
opends/src/server/org/opends/server/protocols/http/HTTPConnectionHandler.java
@@ -143,11 +143,11 @@
  /**
   * Holds the current client connections. Using {@link ConcurrentHashMap} to
   * ensure no concurrent reads/writes can happen and adds/removes are fast.
   * Using Void for the value since it has no use.
   * ensure no concurrent reads/writes can happen and adds/removes are fast. We
   * only use the keys, so it does not matter what value is put there.
   */
  private Map<ClientConnection, Void> clientConnections =
      new ConcurrentHashMap<ClientConnection, Void>();
  private Map<ClientConnection, ClientConnection> clientConnections =
      new ConcurrentHashMap<ClientConnection, ClientConnection>();
  /** The unique name assigned to this connection handler. */
  private String handlerName;