From f73b655466092169abac34833fb628fce1fcdebe Mon Sep 17 00:00:00 2001
From: jcduff <jcduff@localhost>
Date: Thu, 23 Oct 2008 14:04:24 +0000
Subject: [PATCH] The commit will bring the following features :     - An updated version of the underlying database. BDB JE 3.3 is now used.     - Attribute API refactoring providing a better abstraction and offering improved performances.     - A new GUI called the Control-Panel to replace the Status-Panel: the specifications for this       GUI are available on OpenDS Wiki and contains a link to a mockup.        See <https://www.opends.org/wiki/page/ControlPanelUISpecification>.     - Some changes in the replication protocol to implement "Assured Replication Mode". The        specifications are on OpenDS Wiki at <https://www.opends.org/wiki/page/AssuredMode> and section 7       described some of the replication changes required to support this. Assured Replication is not finished,       but the main replication protocol changes to support it are done. As explained by Gilles on an email on       the Dev mailing list (http://markmail.org/message/46rgo3meq3vriy4a), with these changes the newer versions       of OpenDS may not be able to replicate with OpenDS 1.0 instances.     - Support for Service Tags on the platforms where the functionality is available and enabled. Specifications       are published at <https://www.opends.org/wiki/page/OpenDSServiceTagEnabled>. For more information on       Service Tags see <http://wikis.sun.com/display/ServiceTag/Sun+Service+Tag+FAQ>.     - The Admin Connector service. In order to provide agentry of the OpenDS server at any time, a new service       has been added, dedicated to the administration, configuration and monitoring of the server.       An overview of the Admin Connector service and it's use is available on the       OpenDS wiki <https://www.opends.org/wiki/page/ManagingAdministrationTrafficToTheServer>     - Updates to the various command line tools to support the Admin Connector service.     - Some internal re-architecting of the server to put the foundation of future developments such as virtual       directory services. The new NetworkGroups and WorkFlow internal services which have been specified in       <https://www.opends.org/wiki/page/BasicOperationRoutingThroughNetworkGroup> are now implemented.     - Many bug fixes...

---
 opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java |   63 +++++++++++++++++--------------
 1 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
index 56cadb2..85273f8 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -139,6 +139,13 @@
   // The set of all operations currently in progress on this connection.
   private ConcurrentHashMap<Integer,AbstractOperation> operationsInProgress;
 
+  // The number of operations performed on this connection.
+  // Used to compare with the resource limits of the network group.
+  private long operationsPerformed;
+
+  // Lock on the number of operations
+  private Object operationsPerformedLock;
+
   // The connection security provider that was in use for the client connection
   // before switching to a TLS-based provider.
   private ConnectionSecurityProvider clearSecurityProvider;
@@ -251,6 +258,8 @@
     connectionValid      = true;
     disconnectRequested  = false;
     operationsInProgress = new ConcurrentHashMap<Integer,AbstractOperation>();
+    operationsPerformed = 0;
+    operationsPerformedLock = new Object();
     keepStats            = connectionHandler.keepStats();
     protocol             = "LDAP";
     writeSelector        = new AtomicReference<Selector>();
@@ -297,7 +306,7 @@
    *
    * @return  The connection handler that accepted this client connection.
    */
-  public ConnectionHandler getConnectionHandler()
+  public ConnectionHandler<?> getConnectionHandler()
   {
     return connectionHandler;
   }
@@ -385,18 +394,6 @@
 
 
   /**
-   * Retrieves the address and port of the client system, separated by a colon.
-   *
-   * @return  The address and port of the client system, separated by a colon.
-   */
-  public String getClientHostPort()
-  {
-    return clientAddress + ":" + clientPort;
-  }
-
-
-
-  /**
    * Retrieves a string representation of the address on the server to which the
    * client connected.
    *
@@ -423,18 +420,6 @@
 
 
   /**
-   * Retrieves the address and port of the server system, separated by a colon.
-   *
-   * @return  The address and port of the server system, separated by a colon.
-   */
-  public String getServerHostPort()
-  {
-    return serverAddress + ":" + serverPort;
-  }
-
-
-
-  /**
    * Retrieves the <CODE>java.net.InetAddress</CODE> associated with the remote
    * client system.
    *
@@ -738,7 +723,7 @@
                               SearchResultEntry searchEntry)
   {
     SearchResultEntryProtocolOp protocolOp =
-         new SearchResultEntryProtocolOp(searchEntry);
+         new SearchResultEntryProtocolOp(searchEntry,ldapVersion);
 
     List<Control> entryControls = searchEntry.getControls();
     ArrayList<LDAPControl> controls;
@@ -1199,8 +1184,9 @@
         operationsInProgress.put(messageID, operation);
 
 
-        // Try to add the operation to the work queue.
-        DirectoryServer.enqueueRequest(operation);
+        // Try to add the operation to the work queue,
+        // or run it synchronously (typically for the administration connector)
+        connectionHandler.getQueueingStrategy().enqueueRequest(operation);
       }
       catch (DirectoryException de)
       {
@@ -1481,6 +1467,20 @@
 
 
   /**
+   * Returns the total number of operations initiated on this connection.
+   *
+   * @return the total number of operations on this connection
+   */
+  public long getNumberOfOperations() {
+    long tmpNumberOfOperations;
+    synchronized (operationsPerformedLock) {
+      tmpNumberOfOperations = operationsPerformed;
+    }
+    return tmpNumberOfOperations;
+  }
+
+
+  /**
    * Process the information contained in the provided byte buffer as an ASN.1
    * element.  It may take several calls to this method in order to get all the
    * information necessary to decode a single ASN.1 element, but it may also be
@@ -1793,6 +1793,9 @@
     {
       statTracker.updateMessageRead(message);
     }
+    synchronized (operationsPerformedLock) {
+      operationsPerformed++;
+    }
 
     ArrayList<Control> opControls;
     ArrayList<LDAPControl> ldapControls = message.getControls();
@@ -2807,6 +2810,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public DN getKeyManagerProviderDN()
   {
     return connectionHandler.getKeyManagerProviderDN();
@@ -2817,6 +2821,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public DN getTrustManagerProviderDN()
   {
     return connectionHandler.getTrustManagerProviderDN();
@@ -2834,6 +2839,7 @@
    *          for operations requring a server certificate, or
    *          {@code null} if any alias is acceptable.
    */
+  @Override
   public String getCertificateAlias()
   {
     return connectionHandler.getSSLServerCertNickname();
@@ -2853,6 +2859,7 @@
    * @return  The length of time in milliseconds that this client
    *          connection has been idle.
    */
+  @Override
   public long getIdleTime()
   {
     if (operationsInProgress.isEmpty() && getPersistentSearches().isEmpty())

--
Gitblit v1.10.0