From c96af91cdd11f79c11e56d6c7fe33d0edc653ea3 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 15 Apr 2013 12:08:55 +0000
Subject: [PATCH] OPENDJ-832 (CR-1545) Leverage the work queue for processing requests received on the HTTP connection handler

---
 opends/src/server/org/opends/server/protocols/http/HTTPClientConnection.java |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/opends/src/server/org/opends/server/protocols/http/HTTPClientConnection.java b/opends/src/server/org/opends/server/protocols/http/HTTPClientConnection.java
index 3cb3d59..361d045 100644
--- a/opends/src/server/org/opends/server/protocols/http/HTTPClientConnection.java
+++ b/opends/src/server/org/opends/server/protocols/http/HTTPClientConnection.java
@@ -28,6 +28,7 @@
 
 import static org.forgerock.opendj.adapter.server2x.Converters.*;
 import static org.opends.messages.ProtocolMessages.*;
+import static org.opends.server.loggers.AccessLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
 
 import java.net.InetAddress;
@@ -47,7 +48,6 @@
 import org.opends.messages.Message;
 import org.opends.messages.MessageBuilder;
 import org.opends.server.api.ClientConnection;
-import org.opends.server.api.ConnectionHandler;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.SearchOperation;
 import org.opends.server.loggers.debug.DebugTracer;
@@ -171,11 +171,6 @@
     this.request = request;
 
     this.connectionID = DirectoryServer.newConnectionAccepted(this);
-    if (this.connectionID < 0)
-    {
-      disconnect(DisconnectReason.ADMIN_LIMIT_EXCEEDED, true,
-          ERR_CONNHANDLER_REJECTED_BY_SERVER.get());
-    }
   }
 
   /** {@inheritDoc} */
@@ -187,7 +182,7 @@
 
   /** {@inheritDoc} */
   @Override
-  public ConnectionHandler<?> getConnectionHandler()
+  public HTTPConnectionHandler getConnectionHandler()
   {
     return connectionHandler;
   }
@@ -315,8 +310,7 @@
   protected boolean sendIntermediateResponseMessage(
       IntermediateResponse intermediateResponse)
   {
-    // TODO Auto-generated method stub
-    return false;
+    throw new RuntimeException("Not implemented");
   }
 
   /**
@@ -372,6 +366,10 @@
           .getClosureMessage()));
     }
     finalizeConnectionInternal();
+
+
+    this.connectionHandler.removeClientConnection(this);
+    logDisconnect(this, disconnectReason, message);
   }
 
   /** {@inheritDoc} */
@@ -475,7 +473,7 @@
             op.operation.abort(cancelRequest);
           }
           catch (Exception e)
-          { // make sure all operations are cancelled, no mattter what
+          { // make sure all operations are cancelled, no matter what
             if (debugEnabled())
             {
               TRACER.debugCaught(DebugLogLevel.ERROR, e);
@@ -593,4 +591,11 @@
   {
     return connectionValid;
   }
+
+  /** {@inheritDoc} */
+  @Override
+  public boolean isInnerConnection()
+  {
+    return true;
+  }
 }

--
Gitblit v1.10.0