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

Jean-Noël Rouvignac
20.42.2016 61b9eb1be03fc03a9f4bb0013a08ff44a1059503
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -71,7 +71,6 @@
public final class LDAPClientConnection extends ClientConnection implements
    TLSCapableConnection
{
  /**
   * A runnable whose task is to close down all IO related channels
   * associated with a client connection after a small delay.
@@ -92,9 +91,6 @@
      this.socketChannel = socketChannel;
    }
    /** {@inheritDoc} */
    @Override
    public void run()
    {
@@ -163,8 +159,6 @@
      clientChannel.close();
    }
    @Override
    public int write(ByteBuffer byteBuffer) throws IOException
    {
@@ -288,13 +282,10 @@
    }
  }
  /** The tracer object for the debug logger. */
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  /**
   * Thread local ASN1Writer and buffer.
   */
  /** Thread local ASN1Writer and buffer. */
  private static final class ASN1WriterHolder implements Closeable
  {
    private final ASN1Writer writer;
@@ -308,7 +299,6 @@
      this.writer = ASN1.getWriter(buffer, maxBufferSize);
    }
    /** {@inheritDoc} */
    @Override
    public void close() throws IOException
    {
@@ -317,13 +307,10 @@
    }
  }
  /**
   * Cached ASN1 writer: a thread can only write to one connection at a time.
   */
  /** Cached ASN1 writer: a thread can only write to one connection at a time. */
  private static final ThreadLocal<ASN1WriterHolder> ASN1_WRITER_CACHE =
      new ThreadLocal<ASN1WriterHolder>()
  {
    /** {@inheritDoc} */
    @Override
    protected ASN1WriterHolder initialValue()
    {
@@ -345,10 +332,8 @@
  /** The time that the last operation was completed. */
  private final AtomicLong lastCompletionTime;
  /** The next operation ID that should be used for this connection. */
  private final AtomicLong nextOperationID;
  /** The selector that may be used for write operations. */
  private final AtomicReference<Selector> writeSelector;
@@ -381,55 +366,35 @@
  /** The port on the client from which this connection originated. */
  private final int clientPort;
  /**
   * The LDAP version that the client is using to communicate with the server.
   */
  /** The LDAP version that the client is using to communicate with the server. */
  private int ldapVersion;
  /** The port on the server to which this client has connected. */
  private final int serverPort;
  /** The reference to the connection handler that accepted this connection. */
  private final LDAPConnectionHandler connectionHandler;
  /** The statistics tracker associated with this client connection. */
  private final LDAPStatistics statTracker;
  private boolean useNanoTime;
  /** The connection ID assigned to this connection. */
  private final long connectionID;
  /**
   * The lock used to provide threadsafe access to the set of operations in
   * progress.
   */
  /** The lock used to provide threadsafe access to the set of operations in progress. */
  private final Object opsInProgressLock;
  /** The socket channel with which this client connection is associated. */
  private final SocketChannel clientChannel;
  /** The byte channel used for blocking writes with time out. */
  private final ByteChannel timeoutClientChannel;
  /** The string representation of the address of the client. */
  private final String clientAddress;
  /**
   * The name of the protocol that the client is using to communicate with the
   * server.
   */
  /** The name of the protocol that the client is using to communicate with the server. */
  private final String protocol;
  /**
   * The string representation of the address of the server to which the client
   * has connected.
   */
  /** The string representation of the address of the server to which the client has connected. */
  private final String serverAddress;
  private ASN1ByteChannelReader asn1Reader;
  private final int bufferSize;
  private final RedirectingByteChannel saslChannel;
@@ -439,7 +404,6 @@
  private volatile ConnectionSecurityProvider saslPendingProvider;
  private volatile ConnectionSecurityProvider tlsPendingProvider;
  /**
   * Creates a new LDAP client connection with the provided information.
   *
@@ -511,8 +475,6 @@
    return connectionID;
  }
  /**
   * Retrieves the connection handler that accepted this client
   * connection.
@@ -526,8 +488,6 @@
    return connectionHandler;
  }
  /**
   * Retrieves the socket channel that can be used to communicate with
   * the client.
@@ -541,8 +501,6 @@
    return clientChannel;
  }
  /**
   * Retrieves the protocol that the client is using to communicate with
   * the Directory Server.
@@ -556,8 +514,6 @@
    return protocol;
  }
  /**
   * Retrieves a string representation of the address of the client.
   *
@@ -569,8 +525,6 @@
    return clientAddress;
  }
  /**
   * Retrieves the port number for this connection on the client system.
   *
@@ -582,8 +536,6 @@
    return clientPort;
  }
  /**
   * Retrieves a string representation of the address on the server to
   * which the client connected.
@@ -597,8 +549,6 @@
    return serverAddress;
  }
  /**
   * Retrieves the port number for this connection on the server system.
   *
@@ -610,8 +560,6 @@
    return serverPort;
  }
  /**
   * Retrieves the <CODE>java.net.InetAddress</CODE> associated with the
   * remote client system.
@@ -626,8 +574,6 @@
    return clientChannel.socket().getInetAddress();
  }
  /**
   * Retrieves the <CODE>java.net.InetAddress</CODE> for the Directory
   * Server system to which the client has established the connection.
@@ -643,7 +589,6 @@
    return clientChannel.socket().getLocalAddress();
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConnectionValid()
  {
@@ -677,8 +622,6 @@
    return secure;
  }
  /**
   * Sends a response to the client based on the information in the
   * provided operation.
@@ -721,8 +664,6 @@
    }
  }
  /**
   * Retrieves an LDAPMessage containing a response generated from the
   * provided operation.
@@ -860,8 +801,6 @@
        controls);
  }
  /**
   * Sends the provided search result entry to the client.
   *
@@ -881,8 +820,6 @@
        protocolOp, searchEntry.getControls()));
  }
  /**
   * Sends the provided search result reference to the client.
   *
@@ -919,8 +856,6 @@
    return true;
  }
  /**
   * Sends the provided intermediate response message to the client.
   *
@@ -949,8 +884,6 @@
    return connectionValid;
  }
  /**
   * Sends the provided LDAP message to the client.
   *
@@ -999,8 +932,6 @@
    }
 }
  /**
   * Closes the connection to the client, optionally sending it a
   * message indicating the reason for the closure. Note that the
@@ -1154,8 +1085,6 @@
    }
  }
  /**
   * Retrieves the set of operations in progress for this client
   * connection. This list must not be altered by any caller.
@@ -1169,8 +1098,6 @@
    return operationsInProgress.values();
  }
  /**
   * Retrieves the operation in progress with the specified message ID.
   *
@@ -1185,8 +1112,6 @@
    return operationsInProgress.get(messageID);
  }
  /**
   * Adds the provided operation to the set of operations in progress
   * for this client connection.
@@ -1261,8 +1186,6 @@
    }
  }
  /**
   * Removes the provided operation from the set of operations in
   * progress for this client connection. Note that this does not make
@@ -1296,8 +1219,6 @@
    return true;
  }
  /**
   * Attempts to cancel the specified operation.
   *
@@ -1337,8 +1258,6 @@
    }
  }
  /**
   * Attempts to cancel all operations in progress on this connection.
   *
@@ -1392,8 +1311,6 @@
    }
  }
  /**
   * Attempts to cancel all operations in progress on this connection
   * except the operation with the specified message ID.
@@ -1462,9 +1379,6 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public Selector getWriteSelector()
  {
@@ -1489,17 +1403,12 @@
    return selector;
  }
  /** {@inheritDoc} */
  @Override
  public long getMaxBlockedWriteTimeLimit()
  {
    return connectionHandler.getMaxBlockedWriteTimeLimit();
  }
  /**
   * Returns the total number of operations initiated on this
   * connection.
@@ -1512,8 +1421,6 @@
    return operationsPerformed.get();
  }
  /**
   * Returns the ASN1 reader for this connection.
   *
@@ -1524,8 +1431,6 @@
    return asn1Reader;
  }
  /**
   * Process data read.
   *
@@ -1578,8 +1483,6 @@
    }
  }
  /**
   * Processes the provided LDAP message read from the client and takes
   * whatever action is appropriate. For most requests, this will
@@ -1707,8 +1610,6 @@
    }
  }
  /**
   * Processes the provided LDAP message as an abandon request.
   *
@@ -1756,8 +1657,6 @@
    return connectionValid;
  }
  /**
   * Processes the provided LDAP message as an add request.
   *
@@ -1813,8 +1712,6 @@
    return connectionValid;
  }
  /**
   * Processes the provided LDAP message as a bind request.
   *
@@ -1944,8 +1841,6 @@
    return connectionValid;
  }
  /**
   * Processes the provided LDAP message as a compare request.
   *
@@ -2003,8 +1898,6 @@
    return connectionValid;
  }
  /**
   * Processes the provided LDAP message as a delete request.
   *
@@ -2061,8 +1954,6 @@
    return connectionValid;
  }
  /**
   * Processes the provided LDAP message as an extended request.
   *
@@ -2125,8 +2016,6 @@
    return connectionValid;
  }
  /**
   * Processes the provided LDAP message as a modify request.
   *
@@ -2183,8 +2072,6 @@
    return connectionValid;
  }
  /**
   * Processes the provided LDAP message as a modify DN request.
   *
@@ -2242,8 +2129,6 @@
    return connectionValid;
  }
  /**
   * Processes the provided LDAP message as a search request.
   *
@@ -2303,8 +2188,6 @@
    return connectionValid;
  }
  /**
   * Processes the provided LDAP message as an unbind request.
   *
@@ -2331,9 +2214,6 @@
    return false;
  }
  /** {@inheritDoc} */
  @Override
  public String getMonitorSummary()
  {
@@ -2395,8 +2275,6 @@
    return buffer.toString();
  }
  /**
   * Appends a string representation of this client connection to the
   * provided buffer.
@@ -2417,9 +2295,6 @@
    buffer.append(serverPort);
  }
  /** {@inheritDoc} */
  @Override
  public boolean prepareTLS(LocalizableMessageBuilder unavailableReason)
  {
@@ -2452,8 +2327,6 @@
    return true;
  }
  /**
   * Retrieves the length of time in milliseconds that this client
   * connection has been idle. <BR>
@@ -2480,8 +2353,6 @@
    }
  }
  /**
   * Set the connection provider that is not in use yet. Used in TLS
   * negotiation when a clear response is needed before the connection
@@ -2495,8 +2366,6 @@
    tlsPendingProvider = provider;
  }
  /**
   * Set the connection provider that is not in use. Used in SASL
   * negotiation when a clear response is needed before the connection
@@ -2510,11 +2379,7 @@
    saslPendingProvider = provider;
  }
  /**
   * Enable the provider that is inactive.
   */
  /** Enable the provider that is inactive. */
  private void enableTLS()
  {
    tlsActiveProvider = tlsPendingProvider;
@@ -2522,8 +2387,6 @@
    tlsPendingProvider = null;
  }
  /**
   * Set the security provider to the specified provider.
   *
@@ -2536,11 +2399,7 @@
    tlsChannel.redirect(sslProvider);
  }
  /**
   * Enable the SASL provider that is currently inactive or pending.
   */
  /** Enable the SASL provider that is currently inactive or pending. */
  private void enableSASL()
  {
    saslActiveProvider = saslPendingProvider;
@@ -2548,8 +2407,6 @@
    saslPendingProvider = null;
  }
  /**
   * Return the certificate chain array associated with a connection.
   *
@@ -2568,8 +2425,6 @@
    return new Certificate[0];
  }
  /**
   * Retrieves the TLS redirecting byte channel used in a LDAP client
   * connection.
@@ -2581,9 +2436,6 @@
     return this.tlsChannel;
   }
  /** {@inheritDoc} */
  @Override
  public int getSSF()
  {
@@ -2592,9 +2444,6 @@
    return Math.max(tlsSSF, saslSSF);
  }
  /** {@inheritDoc} */
  @Override
  public void finishBind()
  {
@@ -2606,9 +2455,6 @@
    super.finishBind();
  }
  /** {@inheritDoc} */
  @Override
  public void finishStartTLS()
  {