From bf62fe2d81a22e50065a0c682a4ffb2a1308122f Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 02 Feb 2007 20:35:01 +0000
Subject: [PATCH] Update the code involving change notification listeners to ensure that they are invoked just before the response is sent to the client rather than just after the response.  This can help avoid race conditions in which the server needs to use a change notification listener to perform some additional processing for a given operation, and the client sends a second request that depends on this processing immediately after receiving a "success" response for the operation that triggered the change notification.

---
 opends/src/server/org/opends/server/core/DeleteOperation.java |   35 ++++++++++++++++++++---------------
 1 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/DeleteOperation.java b/opends/src/server/org/opends/server/core/DeleteOperation.java
index 93d3841..f144e2c 100644
--- a/opends/src/server/org/opends/server/core/DeleteOperation.java
+++ b/opends/src/server/org/opends/server/core/DeleteOperation.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Portions Copyright 2006 Sun Microsystems, Inc.
+ *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  */
 package org.opends.server.core;
 
@@ -1197,20 +1197,8 @@
     }
 
 
-    // Stop the processing timer.
-    processingStopTime = System.currentTimeMillis();
-
-
-    // Send the delete response to the client.
-    getClientConnection().sendResponse(this);
-
-
-    // Log the delete response.
-    logDeleteResponse(this);
-
-
-    // Notify any change listeners and/or persistent searches that might be
-    // registered with the server.
+    // Notify any change notification listeners that might be registered with
+    // the server.
     if (getResultCode() == ResultCode.SUCCESS)
     {
       for (ChangeNotificationListener changeListener :
@@ -1230,7 +1218,24 @@
                    message, msgID);
         }
       }
+    }
 
+
+    // Stop the processing timer.
+    processingStopTime = System.currentTimeMillis();
+
+
+    // Send the delete response to the client.
+    getClientConnection().sendResponse(this);
+
+
+    // Log the delete response.
+    logDeleteResponse(this);
+
+
+    // Notify any persistent searches that might be registered with the server.
+    if (getResultCode() == ResultCode.SUCCESS)
+    {
       for (PersistentSearch persistentSearch :
            DirectoryServer.getPersistentSearches())
       {

--
Gitblit v1.10.0