From f5a806f2303643649722d7303022e2787fbe299b 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
---
opendj-sdk/opends/src/server/org/opends/server/protocols/http/SdkConnectionAdapter.java | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/http/SdkConnectionAdapter.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/http/SdkConnectionAdapter.java
index 9e1d354..e878683 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/http/SdkConnectionAdapter.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/http/SdkConnectionAdapter.java
@@ -69,8 +69,10 @@
import org.opends.server.core.UnbindOperationBasis;
import org.opends.server.core.WorkQueueStrategy;
import org.opends.server.loggers.debug.DebugTracer;
+import org.opends.server.types.AuthenticationInfo;
import org.opends.server.types.ByteString;
import org.opends.server.types.DebugLogLevel;
+import org.opends.server.types.DisconnectReason;
import org.opends.server.types.Operation;
import com.forgerock.opendj.util.AsynchronousFutureResult;
@@ -125,6 +127,8 @@
try
{
+ operation.setInnerOperation(this.clientConnection.isInnerConnection());
+
// need this raw cast here to fool the compiler's generic type safety
// Problem here is due to the generic type R on enqueueOperation()
clientConnection.addOperationInProgress(operation,
@@ -201,14 +205,21 @@
@Override
public void close(UnbindRequest request, String reason)
{
- final int messageID = nextMessageID.get();
- UnbindOperationBasis operation =
- new UnbindOperationBasis(clientConnection, messageID, messageID,
- to(request.getControls()));
+ AuthenticationInfo authInfo = this.clientConnection.getAuthenticationInfo();
+ if (authInfo != null && authInfo.isAuthenticated())
+ {
+ final int messageID = nextMessageID.get();
+ UnbindOperationBasis operation =
+ new UnbindOperationBasis(clientConnection, messageID, messageID,
+ to(request.getControls()));
- // run synchronous
- operation.run();
-
+ // run synchronous
+ operation.run();
+ }
+ else
+ {
+ this.clientConnection.disconnect(DisconnectReason.UNBIND, false, null);
+ }
isClosed = true;
}
--
Gitblit v1.10.0