From d696d8f9c4b425df6fbb2d523d7dc503745fcb72 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Mon, 21 Jan 2008 12:17:56 +0000
Subject: [PATCH] Fix issue 2850.
---
opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java | 43 +++++++++++++++++++++----------------------
1 files changed, 21 insertions(+), 22 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 53acdb8..649662c 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ * Portions Copyright 2006-2008 Sun Microsystems, Inc.
*/
package org.opends.server.protocols.ldap;
@@ -946,10 +946,18 @@
boolean sendNotification,
Message message)
{
- // If we are already in the middle of a disconnect, then don't do anything.
- if (disconnectRequested)
+ // Set a flag indicating that the connection is being terminated so that no
+ // new requests will be accepted. Also cancel all operations in progress.
+ synchronized (opsInProgressLock)
{
- return;
+ // If we are already in the middle of a disconnect, then don't
+ // do anything.
+ if (disconnectRequested)
+ {
+ return;
+ }
+
+ disconnectRequested = true;
}
@@ -968,23 +976,6 @@
connectionValid = false;
- // Set a flag indicating that the connection is being terminated so that no
- // new requests will be accepted. Also cancel all operations in progress.
- synchronized (opsInProgressLock)
- {
- try
- {
- disconnectRequested = true;
- }
- catch (Exception e)
- {
- if (debugEnabled())
- {
- TRACER.debugCaught(DebugLogLevel.ERROR, e);
- }
- }
- }
-
cancelAllOperations(new CancelRequest(true, message));
finalizeConnectionInternal();
@@ -1322,7 +1313,15 @@
{
try
{
- CancelResult cancelResult = o.cancel(cancelRequest);
+ CancelResult cancelResult = o.getCancelResult();
+ if (cancelResult == null) {
+ // Before calling cancelling the operation, we need to
+ // mark this operation as cancelled so that the attempt to
+ // cancel it later won't cause an unnecessary delay.
+ o.setCancelResult(CancelResult.CANCELED);
+ cancelResult = o.cancel(cancelRequest);
+ }
+
if (keepStats && (cancelResult == CancelResult.CANCELED))
{
statTracker.updateAbandonedOperation();
--
Gitblit v1.10.0