From 1ad53161c35dfbd2c08b1f124d237f5f3cad9110 Mon Sep 17 00:00:00 2001
From: jdemendi <jdemendi@localhost>
Date: Thu, 19 Jul 2007 07:46:13 +0000
Subject: [PATCH] This set of changes is aiming at having a more consistent and clean code when an operation is canceled.

---
 opends/src/server/org/opends/server/core/SearchOperationBasis.java                                |   64 ++
 opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java |   95 +----
 opends/src/server/org/opends/server/core/AddOperationBasis.java                                   |  157 ++++++--
 opends/src/server/org/opends/server/core/CompareOperationBasis.java                               |   68 +++
 opends/src/server/org/opends/server/core/BindOperationBasis.java                                  |   92 +++--
 opends/src/server/org/opends/server/core/DeleteOperationBasis.java                                |  148 ++++++--
 opends/src/server/org/opends/server/core/ModifyDNOperationBasis.java                              |  222 ++++++++-----
 opends/src/server/org/opends/server/core/ModifyOperationBasis.java                                |  147 ++++++--
 8 files changed, 630 insertions(+), 363 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/AddOperationBasis.java b/opends/src/server/org/opends/server/core/AddOperationBasis.java
index 59a9e79..b5bf806 100644
--- a/opends/src/server/org/opends/server/core/AddOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/AddOperationBasis.java
@@ -796,9 +796,9 @@
 
 
     // Check for and handle a request to cancel this operation.
-    if (getCancelRequest() != null)
+    if (cancelRequest != null)
     {
-      indicateCancelled(getCancelRequest());
+      indicateCancelled(cancelRequest);
       setProcessingStopTime();
       return;
     }
@@ -808,9 +808,14 @@
     PluginConfigManager pluginConfigManager =
       DirectoryServer.getPluginConfigManager();
 
+
+    // This flag is set to true as soon as a workflow has been executed.
+    boolean workflowExecuted = false;
+
+
     // Create a labeled block of code that we can break out of if a problem is
     // detected.
-    addProcessing:
+addProcessing:
     {
       // Invoke the pre-parse add plugins.
       PreParsePluginResult preParseResult =
@@ -845,14 +850,10 @@
       logAddRequest(this);
 
 
-      // Check for and handle a request to cancel this operation.
-      if (getCancelRequest() != null)
+      // Check for a request to cancel this operation.
+      if (cancelRequest != null)
       {
-        indicateCancelled(getCancelRequest());
-        setProcessingStopTime();
-        logAddResponse(this);
-        pluginConfigManager.invokePostResponseAddPlugins(this);
-        return;
+        break addProcessing;
       }
 
 
@@ -877,18 +878,37 @@
         break addProcessing;
       }
       workflow.execute(this);
+      workflowExecuted = true;
+
+    } // end of processing block
+
+
+    // Check for a terminated connection.
+    if (getCancelResult() == CancelResult.CANCELED)
+    {
+      // Stop the processing timer.
+      setProcessingStopTime();
+
+      // Log the add response message.
+      logAddResponse(this);
+
+      return;
     }
 
     // Check for and handle a request to cancel this operation.
-    if ((getCancelRequest() != null) ||
-        (getCancelResult() == CancelResult.CANCELED))
+    if (cancelRequest != null)
     {
-      if (getCancelRequest() != null){
-        indicateCancelled(getCancelRequest());
-      }
+      indicateCancelled(cancelRequest);
+
+      // Stop the processing timer.
       setProcessingStopTime();
+
+      // Log the add response message.
       logAddResponse(this);
-      invokePostResponsePlugins();
+
+      // Invoke the post-response add plugins.
+      invokePostResponsePlugins(workflowExecuted);
+
       return;
     }
 
@@ -899,21 +919,86 @@
     setProcessingStopTime();
 
     // Send the add response to the client.
-    getClientConnection().sendResponse(this);
+    clientConnection.sendResponse(this);
 
-    // Log the add response.
+    // Log the add response message.
     logAddResponse(this);
 
-    // Check wether there are local operations in attachments
+    // Notifies any persistent searches that might be registered with the
+    // server.
+    notifyPersistentSearches(workflowExecuted);
+
+    // Invoke the post-response add plugins.
+    invokePostResponsePlugins(workflowExecuted);
+  }
+
+
+  /**
+   * Invokes the post response plugins. If a workflow has been executed
+   * then invoke the post response plugins provided by the workflow
+   * elements of the worklfow, otherwise invoke the post reponse plugins
+   * that have been registered with the current operation.
+   *
+   * @param workflowExecuted <code>true</code> if a workflow has been
+   *                         executed
+   */
+  private void invokePostResponsePlugins(boolean workflowExecuted)
+  {
+    // Get the plugin config manager that will be used for invoking plugins.
+    PluginConfigManager pluginConfigManager =
+      DirectoryServer.getPluginConfigManager();
+
+    // Invoke the post response plugins
+    if (workflowExecuted)
+    {
+      // Invoke the post response plugins that have been registered by
+      // the workflow elements
+      List localOperations =
+        (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
+
+      if (localOperations != null)
+      {
+        for (Object localOp : localOperations)
+        {
+          LocalBackendAddOperation localOperation =
+            (LocalBackendAddOperation)localOp;
+          pluginConfigManager.invokePostResponseAddPlugins(localOperation);
+        }
+      }
+    }
+    else
+    {
+      // Invoke the post response plugins that have been registered with
+      // the current operation
+      pluginConfigManager.invokePostResponseAddPlugins(this);
+    }
+  }
+
+
+  /**
+   * Notifies any persistent searches that might be registered with the server.
+   * If no workflow has been executed then don't notify persistent searches.
+   *
+   * @param workflowExecuted <code>true</code> if a workflow has been
+   *                         executed
+   */
+  private void notifyPersistentSearches(boolean workflowExecuted)
+  {
+    if (! workflowExecuted)
+    {
+      return;
+    }
+
     List localOperations =
       (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
-    if (localOperations != null && (! localOperations.isEmpty())){
+
+    if (localOperations != null)
+    {
       for (Object localOp : localOperations)
       {
         LocalBackendAddOperation localOperation =
           (LocalBackendAddOperation)localOp;
-        // Notify any persistent searches that might be registered with the
-        // server.
+
         if ((getResultCode() == ResultCode.SUCCESS) &&
             (localOperation.getEntryToAdd() != null))
         {
@@ -944,13 +1029,11 @@
             }
           }
         }
-
-        // Invoke the post-response add plugins.
-        pluginConfigManager.invokePostResponseAddPlugins(localOperation);
       }
     }
   }
 
+
   /**
    * Updates the error message and the result code of the operation.
    *
@@ -985,30 +1068,6 @@
     }
   }
 
-  /**
-   * Execute the postResponseAddPlugins.
-   */
-  private void invokePostResponsePlugins()
-  {
-    // Get the plugin config manager that will be used for invoking plugins.
-    PluginConfigManager pluginConfigManager =
-      DirectoryServer.getPluginConfigManager();
-
-    // Check wether there are local operations in attachments
-    List localOperations =
-      (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
-
-    if (localOperations != null && (! localOperations.isEmpty()))
-    {
-      for (Object localOp : localOperations)
-      {
-        LocalBackendAddOperation localOperation =
-          (LocalBackendAddOperation)localOp;
-        // Invoke the post-response add plugins.
-        pluginConfigManager.invokePostResponseAddPlugins(localOperation);
-      }
-    }
-  }
 
   /**
    * {@inheritDoc}
diff --git a/opends/src/server/org/opends/server/core/BindOperationBasis.java b/opends/src/server/org/opends/server/core/BindOperationBasis.java
index 72f04e8..94dba4d 100644
--- a/opends/src/server/org/opends/server/core/BindOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/BindOperationBasis.java
@@ -807,9 +807,13 @@
       DirectoryServer.getPluginConfigManager();
 
 
+    // This flag is set to true as soon as a workflow has been executed.
+    boolean workflowExecuted = false;
+
+
     // Create a labeled block of code that we can break out of if a problem is
     // detected.
-    bindProcessing:
+bindProcessing:
     {
       // Invoke the pre-parse bind plugins.
       PreParsePluginResult preParseResult =
@@ -877,15 +881,19 @@
         break bindProcessing;
       }
       workflow.execute(this);
-    }
+      workflowExecuted = true;
 
-    // Check for and handle a request to cancel this operation.
+    } // end of processing block
+
+    // Check for a terminated connection.
     if (getCancelResult() == CancelResult.CANCELED)
     {
+      // Stop the processing timer.
       setProcessingStopTime();
+
+      // Log the bind response message.
       logBindResponse(this);
-      invokePostResponsePlugins();
-      clientConnection.setBindInProgress(false);
+
       return;
     }
 
@@ -905,20 +913,52 @@
     // Log the bind response.
     logBindResponse(this);
 
-    // Check wether there are local operations in attachments
-    List localOperations =
-      (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
-    if (localOperations != null && (! localOperations.isEmpty())){
-      for (Object localOp : localOperations)
+    // Invoke the post-response bind plugins.
+    invokePostResponsePlugins(workflowExecuted);
+  }
+
+
+  /**
+   * Invokes the post response plugins. If a workflow has been executed
+   * then invoke the post response plugins provided by the workflow
+   * elements of the worklfow, otherwise invoke the post reponse plugins
+   * that have been registered with the current operation.
+   *
+   * @param workflowExecuted <code>true</code> if a workflow has been
+   *                         executed
+   */
+  private void invokePostResponsePlugins(boolean workflowExecuted)
+  {
+    // Get the plugin config manager that will be used for invoking plugins.
+    PluginConfigManager pluginConfigManager =
+      DirectoryServer.getPluginConfigManager();
+
+    // Invoke the post response plugins
+    if (workflowExecuted)
+    {
+      // The post responses are provided by the workflow elements of the
+      // workflow.
+      List localOperations =
+        (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
+      if (localOperations != null)
       {
-        LocalBackendBindOperation localOperation =
-          (LocalBackendBindOperation)localOp;
-        // Invoke the post-response bind plugins.
-        pluginConfigManager.invokePostResponseBindPlugins(localOperation);
+        for (Object localOp : localOperations)
+        {
+          LocalBackendBindOperation localOperation =
+            (LocalBackendBindOperation)localOp;
+          // Invoke the post-response bind plugins.
+          pluginConfigManager.invokePostResponseBindPlugins(localOperation);
+        }
+      }
+      else
+      {
+        // The current operation does not implement any bind post response
+        // interface so we cannot invoke any post-response plugin.
       }
     }
   }
 
+
   /**
    * Updates the error message and the result code of the operation.
    *
@@ -934,29 +974,5 @@
     setAuthFailureReason(msgID, message);
   }
 
-  /**
-   * Execute the postResponseBindPlugins.
-   */
-  private void invokePostResponsePlugins()
-  {
-    // Get the plugin config manager that will be used for invoking plugins.
-    PluginConfigManager pluginConfigManager =
-      DirectoryServer.getPluginConfigManager();
-
-    // Check wether there are local operations in attachments
-    List localOperations =
-      (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
-
-    if (localOperations != null && (! localOperations.isEmpty())){
-      for (Object localOp : localOperations)
-      {
-        LocalBackendBindOperation localOperation =
-          (LocalBackendBindOperation)localOp;
-        // Invoke the post-response bind plugins.
-        pluginConfigManager.invokePostResponseBindPlugins(localOperation);
-      }
-    }
-  }
-
 }
 
diff --git a/opends/src/server/org/opends/server/core/CompareOperationBasis.java b/opends/src/server/org/opends/server/core/CompareOperationBasis.java
index e4f74f8..4c90a69 100644
--- a/opends/src/server/org/opends/server/core/CompareOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/CompareOperationBasis.java
@@ -473,10 +473,11 @@
     PluginConfigManager pluginConfigManager =
          DirectoryServer.getPluginConfigManager();
 
+    // This flag is set to true as soon as a workflow has been executed.
+    boolean workflowExecuted = false;
 
     // Create a labeled block of code that we can break out of if a problem is
     // detected.
-    boolean workflowExecuted = false;
 compareProcessing:
     {
       // Invoke the pre-parse compare plugins.
@@ -513,14 +514,10 @@
       logCompareRequest(this);
 
 
-      // Check for and handle a request to cancel this operation.
+      // Check for a request to cancel this operation.
       if (cancelRequest != null)
       {
-        indicateCancelled(cancelRequest);
-        setProcessingStopTime();
-        logCompareResponse(this);
-        pluginConfigManager.invokePostResponseComparePlugins(this);
-        return;
+        break compareProcessing;
       }
 
 
@@ -560,15 +557,36 @@
       }
       workflow.execute(this);
       workflowExecuted = true;
+
+    } // end of processing block
+
+
+    // Check for a terminated connection.
+    if (getCancelResult() == CancelResult.CANCELED)
+    {
+      // Stop the processing timer.
+      setProcessingStopTime();
+
+      // Log the add response message.
+      logCompareResponse(this);
+
+      return;
     }
 
     // Check for and handle a request to cancel this operation.
     if (cancelRequest != null)
     {
       indicateCancelled(cancelRequest);
+
+      // Stop the processing timer.
       setProcessingStopTime();
+
+      // Log the compare response message.
       logCompareResponse(this);
-      pluginConfigManager.invokePostResponseComparePlugins(this);
+
+      // Invoke the post-response compare plugins.
+      invokePostResponsePlugins(workflowExecuted);
+
       return;
     }
 
@@ -578,21 +596,41 @@
     // Stop the processing timer.
     setProcessingStopTime();
 
-    // Send the compare response to the client unless the operation result
-    // code is CANCELED
-    if (getResultCode() != ResultCode.CANCELED)
-    {
-      clientConnection.sendResponse(this);
-    }
+    // Send the compare response to the client.
+    clientConnection.sendResponse(this);
 
     // Log the compare response message.
     logCompareResponse(this);
 
     // Invoke the post-response compare plugins.
+    invokePostResponsePlugins(workflowExecuted);
+
+  }
+
+
+  /**
+   * Invokes the post response plugins. If a workflow has been executed
+   * then invoke the post response plugins provided by the workflow
+   * elements of the worklfow, otherwise invoke the post reponse plugins
+   * that have been registered with the current operation.
+   *
+   * @param workflowExecuted <code>true</code> if a workflow has been
+   *                         executed
+   */
+  private void invokePostResponsePlugins(boolean workflowExecuted)
+  {
+    // Get the plugin config manager that will be used for invoking plugins.
+    PluginConfigManager pluginConfigManager =
+      DirectoryServer.getPluginConfigManager();
+
+    // Invoke the post response plugins
     if (workflowExecuted)
     {
+      // Invoke the post response plugins that have been registered by
+      // the workflow elements
       List localOperations =
         (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
+
       if (localOperations != null)
       {
         for (Object localOp : localOperations)
@@ -605,6 +643,8 @@
     }
     else
     {
+      // Invoke the post response plugins that have been registered with
+      // the current operation
       pluginConfigManager.invokePostResponseComparePlugins(this);
     }
   }
diff --git a/opends/src/server/org/opends/server/core/DeleteOperationBasis.java b/opends/src/server/org/opends/server/core/DeleteOperationBasis.java
index a930178..32cbaa8 100644
--- a/opends/src/server/org/opends/server/core/DeleteOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/DeleteOperationBasis.java
@@ -469,13 +469,17 @@
     setProcessingStartTime();
 
     // Check for and handle a request to cancel this operation.
-    if (getCancelRequest() != null)
+    if (cancelRequest != null)
     {
-      indicateCancelled(getCancelRequest());
+      indicateCancelled(cancelRequest);
       setProcessingStopTime();
       return;
     }
 
+
+    // This flag is set to true as soon as a workflow has been executed.
+    boolean workflowExecuted = false;
+
     // Create a labeled block of code that we can break out of if a problem is
     // detected.
 deleteProcessing:
@@ -514,14 +518,10 @@
       logDeleteRequest(this);
 
 
-      // Check for and handle a request to cancel this operation.
-      if (getCancelRequest() != null)
+      // Check for a request to cancel this operation.
+      if (cancelRequest != null)
       {
-        indicateCancelled(getCancelRequest());
-        setProcessingStopTime();
-        logDeleteResponse(this);
-        pluginConfigManager.invokePostResponseDeletePlugins(this);
-        return;
+        break deleteProcessing;
       }
 
 
@@ -545,18 +545,37 @@
         break deleteProcessing;
       }
       workflow.execute(this);
+      workflowExecuted = true;
+
+    } // end of processing block
+
+
+    // Check for a terminated connection.
+    if (getCancelResult() == CancelResult.CANCELED)
+    {
+      // Stop the processing timer.
+      setProcessingStopTime();
+
+      // Log the add response message.
+      logDeleteResponse(this);
+
+      return;
     }
 
     // Check for and handle a request to cancel this operation.
-    if ((getCancelRequest() != null) ||
-        (getCancelResult() == CancelResult.CANCELED))
+    if (cancelRequest != null)
     {
-      if (getCancelRequest() != null){
-        indicateCancelled(getCancelRequest());
-      }
+      indicateCancelled(cancelRequest);
+
+      // Stop the processing timer.
       setProcessingStopTime();
+
+      // Log the delete response message.
       logDeleteResponse(this);
-      invokePostResponsePlugins();
+
+      // Invoke the post-response delete plugins.
+      invokePostResponsePlugins(workflowExecuted);
+
       return;
     }
 
@@ -566,18 +585,82 @@
     // Stop the processing timer.
     setProcessingStopTime();
 
-
     // Send the delete response to the client.
     getClientConnection().sendResponse(this);
 
-
     // Log the delete response.
     logDeleteResponse(this);
 
-    // Check wether there are local operations in attachments
+    // Notifies any persistent searches that might be registered with the
+    // server.
+    notifyPersistentSearches(workflowExecuted);
+
+    // Invoke the post-response delete plugins.
+    invokePostResponsePlugins(workflowExecuted);
+  }
+
+
+  /**
+   * Invokes the post response plugins. If a workflow has been executed
+   * then invoke the post response plugins provided by the workflow
+   * elements of the worklfow, otherwise invoke the post reponse plugins
+   * that have been registered with the current operation.
+   *
+   * @param workflowExecuted <code>true</code> if a workflow has been
+   *                         executed
+   */
+  private void invokePostResponsePlugins(boolean workflowExecuted)
+  {
+    // Get the plugin config manager that will be used for invoking plugins.
+    PluginConfigManager pluginConfigManager =
+      DirectoryServer.getPluginConfigManager();
+
+    // Invoke the post response plugins
+    if (workflowExecuted)
+    {
+      // Invoke the post response plugins that have been registered by
+      // the workflow elements
+      List localOperations =
+        (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
+
+      if (localOperations != null)
+      {
+        for (Object localOp : localOperations)
+        {
+          LocalBackendDeleteOperation localOperation =
+            (LocalBackendDeleteOperation)localOp;
+          pluginConfigManager.invokePostResponseDeletePlugins(localOperation);
+        }
+      }
+    }
+    else
+    {
+      // Invoke the post response plugins that have been registered with
+      // the current operation
+      pluginConfigManager.invokePostResponseDeletePlugins(this);
+    }
+  }
+
+
+  /**
+   * Notifies any persistent searches that might be registered with the server.
+   * If no workflow has been executed then don't notify persistent searches.
+   *
+   * @param workflowExecuted <code>true</code> if a workflow has been
+   *                         executed
+   */
+  private void notifyPersistentSearches(boolean workflowExecuted)
+  {
+    if (! workflowExecuted)
+    {
+      return;
+    }
+
     List localOperations =
       (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
-    if (localOperations != null && (! localOperations.isEmpty())){
+
+    if (localOperations != null)
+    {
       for (Object localOp : localOperations)
       {
         LocalBackendDeleteOperation localOperation =
@@ -613,13 +696,11 @@
             }
           }
         }
-
-        // Invoke the post-response delete plugins.
-        pluginConfigManager.invokePostResponseDeletePlugins(localOperation);
       }
     }
   }
 
+
   /**
    * Updates the error message and the result code of the operation.
    *
@@ -633,29 +714,6 @@
                                   String.valueOf(getEntryDN())));
   }
 
-  /**
-   * Execute the postResponseDeletePlugins.
-   */
-  private void invokePostResponsePlugins()
-  {
-    // Get the plugin config manager that will be used for invoking plugins.
-    PluginConfigManager pluginConfigManager =
-      DirectoryServer.getPluginConfigManager();
-
-    // Check wether there are local operations in attachments
-    List localOperations =
-      (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
-
-    if (localOperations != null && (! localOperations.isEmpty())){
-      for (Object localOp : localOperations)
-      {
-        LocalBackendDeleteOperation localOperation =
-          (LocalBackendDeleteOperation)localOp;
-        // Invoke the post-response delete plugins.
-        pluginConfigManager.invokePostResponseDeletePlugins(localOperation);
-      }
-    }
-  }
 
   /**
    * {@inheritDoc}
diff --git a/opends/src/server/org/opends/server/core/ModifyDNOperationBasis.java b/opends/src/server/org/opends/server/core/ModifyDNOperationBasis.java
index 0dedeba..ca64821 100644
--- a/opends/src/server/org/opends/server/core/ModifyDNOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/ModifyDNOperationBasis.java
@@ -52,10 +52,13 @@
 import org.opends.server.types.operation.PreParseModifyDNOperation;
 import static org.opends.server.core.CoreConstants.*;
 import static org.opends.server.loggers.AccessLogger.*;
+
 import org.opends.server.types.DebugLogLevel;
 import org.opends.server.workflowelement.localbackend.*;
+
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
+
 import org.opends.server.loggers.debug.DebugLogger;
 import org.opends.server.loggers.debug.DebugTracer;
 import static org.opends.server.messages.CoreMessages.*;
@@ -610,7 +613,6 @@
   public final void run()
   {
     setResultCode(ResultCode.UNDEFINED);
-    boolean workflowExecuted = false;
 
     // Get the plugin config manager that will be used for invoking plugins.
     PluginConfigManager pluginConfigManager =
@@ -627,9 +629,14 @@
       return;
     }
 
+
+    // This flag is set to true as soon as a workflow has been executed.
+    boolean workflowExecuted = false;
+
+
     // Create a labeled block of code that we can break out of if a problem is
     // detected.
-    modifyDNProcessing:
+modifyDNProcessing:
     {
       // Invoke the pre-parse modify DN plugins.
       PreParsePluginResult preParseResult =
@@ -665,14 +672,10 @@
       logModifyDNRequest(this);
 
 
-      // Check for and handle a request to cancel this operation.
+      // Check for a request to cancel this operation.
       if (cancelRequest != null)
       {
-        indicateCancelled(cancelRequest);
-        setProcessingStopTime();
-        logModifyDNResponse(this);
-        pluginConfigManager.invokePostResponseModifyDNPlugins(this);
-        return;
+        break modifyDNProcessing;
       }
 
       // Process the entry DN, newRDN, and newSuperior elements from their raw
@@ -699,89 +702,160 @@
       workflowExecuted = true;
     }
 
-    // Check for and handle a request to cancel this operation.
-    if ((getCancelRequest() != null) ||
-        (getCancelResult() == CancelResult.CANCELED))
+    // Check for a terminated connection.
+    if (getCancelResult() == CancelResult.CANCELED)
     {
-      if (getCancelRequest() != null){
-        indicateCancelled(getCancelRequest());
-      }
+      // Stop the processing timer.
       setProcessingStopTime();
+
+      // Log the add response message.
       logModifyDNResponse(this);
-      invokePostResponsePlugins();
+
       return;
     }
 
+    // Check for and handle a request to cancel this operation.
+    if (cancelRequest != null)
+    {
+      indicateCancelled(cancelRequest);
+
+      // Stop the processing timer.
+      setProcessingStopTime();
+
+      // Log the modify DN response message.
+      logModifyDNResponse(this);
+
+      // Invoke the post-response modify DN plugins.
+      invokePostResponsePlugins(workflowExecuted);
+
+      return;
+    }
+
+    // Indicate that it is now too late to attempt to cancel the operation.
+    setCancelResult(CancelResult.TOO_LATE);
+
     // Stop the processing timer.
     setProcessingStopTime();
 
     // Send the modify DN response to the client.
     clientConnection.sendResponse(this);
 
-
     // Log the modify DN response.
     logModifyDNResponse(this);
 
-    // If a workflow has been executed to process the operation, then
-    // call the post response plugins against the operations attached
-    // to this operation.
+    // Notifies any persistent searches that might be registered with the
+    // server.
+    notifyPersistentSearches(workflowExecuted);
+
+    // Invoke the post-response modify DN plugins.
+    invokePostResponsePlugins(workflowExecuted);
+  }
+
+
+  /**
+   * Invokes the post response plugins. If a workflow has been executed
+   * then invoke the post response plugins provided by the workflow
+   * elements of the worklfow, otherwise invoke the post reponse plugins
+   * that have been registered with the current operation.
+   *
+   * @param workflowExecuted <code>true</code> if a workflow has been
+   *                         executed
+   */
+  private void invokePostResponsePlugins(boolean workflowExecuted)
+  {
+    // Get the plugin config manager that will be used for invoking plugins.
+    PluginConfigManager pluginConfigManager =
+      DirectoryServer.getPluginConfigManager();
+
+    // Invoke the post response plugins
     if (workflowExecuted)
     {
-      // Check wether there are local operations in attachments
+      // Invoke the post response plugins that have been registered by
+      // the workflow elements
       List localOperations =
         (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
-      if (localOperations != null && (! localOperations.isEmpty())){
-        for (Object localOperation : localOperations)
+
+      if (localOperations != null)
+      {
+        for (Object localOp : localOperations)
         {
-          LocalBackendModifyDNOperation localOp =
-            (LocalBackendModifyDNOperation)localOperation;
-          // Notify any persistent searches that might be registered with
-          // the server.
-          if (getResultCode() == ResultCode.SUCCESS)
-          {
-            for (PersistentSearch persistentSearch :
-              DirectoryServer.getPersistentSearches())
-            {
-              try
-              {
-                persistentSearch.processModifyDN(
-                    localOp,
-                    localOp.getOriginalEntry(),
-                    localOp.getUpdatedEntry());
-              }
-              catch (Exception e)
-              {
-                if (debugEnabled())
-                {
-                  TRACER.debugCaught(DebugLogLevel.ERROR, e);
-                }
-
-                int    msgID   = MSGID_MODDN_ERROR_NOTIFYING_PERSISTENT_SEARCH;
-                String message = getMessage(msgID,
-                    String.valueOf(persistentSearch),
-                    getExceptionMessage(e));
-                logError(ErrorLogCategory.CORE_SERVER,
-                    ErrorLogSeverity.SEVERE_ERROR,
-                    message, msgID);
-
-                DirectoryServer.deregisterPersistentSearch(persistentSearch);
-              }
-            }
-          }
-
-          // Invoke the post-response modify DN plugins.
-          pluginConfigManager.invokePostResponseModifyDNPlugins(localOp);
+          LocalBackendModifyDNOperation localOperation =
+            (LocalBackendModifyDNOperation)localOp;
+          pluginConfigManager.invokePostResponseModifyDNPlugins(localOperation);
         }
       }
     }
-    else {
-      // Invoke the post-response modify DN plugins.
+    else
+    {
+      // Invoke the post response plugins that have been registered with
+      // the current operation
       pluginConfigManager.invokePostResponseModifyDNPlugins(this);
     }
   }
 
 
   /**
+   * Notifies any persistent searches that might be registered with the server.
+   * If no workflow has been executed then don't notify persistent searches.
+   *
+   * @param workflowExecuted <code>true</code> if a workflow has been
+   *                         executed
+   */
+  private void notifyPersistentSearches(boolean workflowExecuted)
+  {
+    if (! workflowExecuted)
+    {
+      return;
+    }
+
+    List localOperations =
+      (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
+
+    if (localOperations != null)
+    {
+      for (Object localOperation : localOperations)
+      {
+        LocalBackendModifyDNOperation localOp =
+          (LocalBackendModifyDNOperation)localOperation;
+        // Notify any persistent searches that might be registered with
+        // the server.
+        if (getResultCode() == ResultCode.SUCCESS)
+        {
+          for (PersistentSearch persistentSearch :
+            DirectoryServer.getPersistentSearches())
+          {
+            try
+            {
+              persistentSearch.processModifyDN(
+                  localOp,
+                  localOp.getOriginalEntry(),
+                  localOp.getUpdatedEntry());
+            }
+            catch (Exception e)
+            {
+              if (debugEnabled())
+              {
+                TRACER.debugCaught(DebugLogLevel.ERROR, e);
+              }
+
+              int    msgID   = MSGID_MODDN_ERROR_NOTIFYING_PERSISTENT_SEARCH;
+              String message = getMessage(msgID,
+                  String.valueOf(persistentSearch),
+                  getExceptionMessage(e));
+              logError(ErrorLogCategory.CORE_SERVER,
+                  ErrorLogSeverity.SEVERE_ERROR,
+                  message, msgID);
+
+              DirectoryServer.deregisterPersistentSearch(persistentSearch);
+            }
+          }
+        }
+      }
+    }
+  }
+
+
+  /**
    * Updates the error message and the result code of the operation.
    *
    * This method is called because no workflows were found to process
@@ -893,30 +967,6 @@
 
 
   /**
-   * Execute the postResponseModifyPlugins.
-   */
-  private void invokePostResponsePlugins()
-  {
-    // Get the plugin config manager that will be used for invoking plugins.
-    PluginConfigManager pluginConfigManager =
-      DirectoryServer.getPluginConfigManager();
-
-    // Check wether there are local operations in attachments
-    List localOperations =
-      (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
-
-    if (localOperations != null && (! localOperations.isEmpty())){
-      for (Object localOp : localOperations)
-      {
-        LocalBackendModifyDNOperation localOperation =
-          (LocalBackendModifyDNOperation)localOp;
-        // Invoke the post-response add plugins.
-        pluginConfigManager.invokePostResponseModifyDNPlugins(localOperation);
-      }
-    }
-  }
-
-  /**
    * {@inheritDoc}
    */
   public DN getNewDN()
diff --git a/opends/src/server/org/opends/server/core/ModifyOperationBasis.java b/opends/src/server/org/opends/server/core/ModifyOperationBasis.java
index f02b61f..5d7e6f8 100644
--- a/opends/src/server/org/opends/server/core/ModifyOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/ModifyOperationBasis.java
@@ -540,14 +540,18 @@
     setProcessingStartTime();
 
     // Check for and handle a request to cancel this operation.
-    if (getCancelRequest() != null)
+    if (cancelRequest != null)
     {
-      indicateCancelled(getCancelRequest());
+      indicateCancelled(cancelRequest);
       setProcessingStopTime();
       return;
     }
 
 
+    // This flag is set to true as soon as a workflow has been executed.
+    boolean workflowExecuted = false;
+
+
     // Create a labeled block of code that we can break out of if a problem is
     // detected.
 modifyProcessing:
@@ -584,13 +588,10 @@
       // Log the modify request message.
       logModifyRequest(this);
 
-      // Check for and handle a request to cancel this operation.
+      // Check for a request to cancel this operation.
       if (getCancelRequest() != null)
       {
-        indicateCancelled(getCancelRequest());
-        setProcessingStopTime();
-        pluginConfigManager.invokePostResponseModifyPlugins(this);
-        return;
+        break modifyProcessing;
       }
 
 
@@ -614,28 +615,43 @@
         break modifyProcessing;
       }
       workflow.execute(this);
+      workflowExecuted = true;
+
+    } // end of processing block
+
+
+    // Check for a terminated connection.
+    if (getCancelResult() == CancelResult.CANCELED)
+    {
+      // Stop the processing timer.
+      setProcessingStopTime();
+
+      // Log the add response message.
+      logModifyResponse(this);
+
+      return;
     }
 
     // Check for and handle a request to cancel this operation.
-    if ((getCancelRequest() != null) ||
-        (getCancelResult() == CancelResult.CANCELED))
+    if (cancelRequest != null)
     {
-      if (getCancelRequest() != null){
-        indicateCancelled(getCancelRequest());
-      }
+      indicateCancelled(cancelRequest);
+
+      // Stop the processing timer.
       setProcessingStopTime();
+
+      // Log the modify response message.
       logModifyResponse(this);
-      invokePostResponsePlugins();
+
+      // Invoke the post-response modify plugins.
+      invokePostResponsePlugins(workflowExecuted);
+
       return;
     }
 
     // Indicate that it is now too late to attempt to cancel the operation.
     setCancelResult(CancelResult.TOO_LATE);
 
-    // -- DONE AT A LOWER LEVEL --
-    // Notify any change notification listeners that might be registered with
-    // the server.
-
     // Stop the processing timer.
     setProcessingStopTime();
 
@@ -645,10 +661,76 @@
     // Log the modify response.
     logModifyResponse(this);
 
-    // Check wether there are local operations in attachments
+    // Notifies any persistent searches that might be registered with the
+    // server.
+    notifyPersistentSearches(workflowExecuted);
+
+    // Invoke the post-response modify plugins.
+    invokePostResponsePlugins(workflowExecuted);
+  }
+
+
+  /**
+   * Invokes the post response plugins. If a workflow has been executed
+   * then invoke the post response plugins provided by the workflow
+   * elements of the worklfow, otherwise invoke the post reponse plugins
+   * that have been registered with the current operation.
+   *
+   * @param workflowExecuted <code>true</code> if a workflow has been
+   *                         executed
+   */
+  private void invokePostResponsePlugins(boolean workflowExecuted)
+  {
+    // Get the plugin config manager that will be used for invoking plugins.
+    PluginConfigManager pluginConfigManager =
+      DirectoryServer.getPluginConfigManager();
+
+    // Invoke the post response plugins
+    if (workflowExecuted)
+    {
+      // Invoke the post response plugins that have been registered by
+      // the workflow elements
+      List localOperations =
+        (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
+
+      if (localOperations != null)
+      {
+        for (Object localOp : localOperations)
+        {
+          LocalBackendModifyOperation localOperation =
+            (LocalBackendModifyOperation)localOp;
+          pluginConfigManager.invokePostResponseModifyPlugins(localOperation);
+        }
+      }
+    }
+    else
+    {
+      // Invoke the post response plugins that have been registered with
+      // the current operation
+      pluginConfigManager.invokePostResponseModifyPlugins(this);
+    }
+  }
+
+
+  /**
+   * Notifies any persistent searches that might be registered with the server.
+   * If no workflow has been executed then don't notify persistent searches.
+   *
+   * @param workflowExecuted <code>true</code> if a workflow has been
+   *                         executed
+   */
+  private void notifyPersistentSearches(boolean workflowExecuted)
+  {
+    if (! workflowExecuted)
+    {
+      return;
+    }
+
     List localOperations =
       (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
-    if (localOperations != null && (! localOperations.isEmpty())){
+
+    if (localOperations != null)
+    {
       for (Object localOp : localOperations)
       {
         LocalBackendModifyOperation localOperation =
@@ -685,13 +767,11 @@
             }
           }
         }
-
-        // Invoke the post-response modify plugins.
-        pluginConfigManager.invokePostResponseModifyPlugins(localOperation);
       }
     }
   }
 
+
   /**
    * Updates the error message and the result code of the operation.
    *
@@ -705,29 +785,6 @@
                                   String.valueOf(getEntryDN())));
   }
 
-  /**
-   * Execute the postResponseModifyPlugins.
-   */
-  private void invokePostResponsePlugins()
-  {
-    // Get the plugin config manager that will be used for invoking plugins.
-    PluginConfigManager pluginConfigManager =
-      DirectoryServer.getPluginConfigManager();
-
-    // Check wether there are local operations in attachments
-    List localOperations =
-      (List)getAttachment(Operation.LOCALBACKENDOPERATIONS);
-
-    if (localOperations != null && (! localOperations.isEmpty())){
-      for (Object localOp : localOperations)
-      {
-        LocalBackendModifyOperation localOperation =
-          (LocalBackendModifyOperation)localOp;
-        // Invoke the post-response add plugins.
-        pluginConfigManager.invokePostResponseModifyPlugins(localOperation);
-      }
-    }
-  }
 
   /**
    * {@inheritDoc}
diff --git a/opends/src/server/org/opends/server/core/SearchOperationBasis.java b/opends/src/server/org/opends/server/core/SearchOperationBasis.java
index 7710d7c..d95e942 100644
--- a/opends/src/server/org/opends/server/core/SearchOperationBasis.java
+++ b/opends/src/server/org/opends/server/core/SearchOperationBasis.java
@@ -1151,8 +1151,7 @@
 
 
       // Invoke the post-response search plugins.
-      DirectoryServer.getPluginConfigManager().
-           invokePostResponseSearchPlugins(this);
+      invokePostResponsePlugins();
     }
   }
 
@@ -1631,17 +1630,18 @@
     setTimeLimitExpiration(timeLimitExpiration);
 
     // Check for and handle a request to cancel this operation.
-    if (getCancelRequest() != null)
+    if (cancelRequest != null)
     {
-      indicateCancelled(getCancelRequest());
+      indicateCancelled(cancelRequest);
       setProcessingStopTime();
       logSearchResultDone(this);
       return;
     }
 
+
     // Create a labeled block of code that we can break out of if a problem is
     // detected.
-    searchProcessing:
+searchProcessing:
     {
       PreParsePluginResult preParseResult =
         pluginConfigManager.invokePreParseSearchPlugins(this);
@@ -1677,13 +1677,9 @@
 
 
       // Check for and handle a request to cancel this operation.
-      if (getCancelRequest() != null)
+      if (cancelRequest != null)
       {
-        indicateCancelled(getCancelRequest());
-        setProcessingStopTime();
-        logSearchResultDone(this);
-        pluginConfigManager.invokePostResponseSearchPlugins(this);
-        return;
+        break searchProcessing;
       }
 
 
@@ -1710,17 +1706,37 @@
       workflow.execute(this);
     }
 
-    // Check for and handle a request to cancel this operation.
-    if ((getCancelRequest() != null) ||
-        (getCancelResult() == CancelResult.CANCELED))
+
+    // Check for a terminated connection.
+    if (getCancelResult() == CancelResult.CANCELED)
     {
-      indicateCancelled(getCancelRequest());
+      // Stop the processing timer.
       setProcessingStopTime();
+
+      // Log the add response message.
       logSearchResultDone(this);
-      pluginConfigManager.invokePostResponseSearchPlugins(this);
+
       return;
     }
 
+    // Check for and handle a request to cancel this operation.
+    if (cancelRequest != null)
+    {
+      indicateCancelled(cancelRequest);
+
+      // Stop the processing timer.
+      setProcessingStopTime();
+
+      // Log the search response message.
+      logSearchResultDone(this);
+
+      // Invoke the post-response search plugins.
+      invokePostResponsePlugins();
+
+      return;
+    }
+
+
     // Indicate that it is now too late to attempt to cancel the operation.
     setCancelResult(CancelResult.TOO_LATE);
 
@@ -1743,6 +1759,22 @@
     }
   }
 
+
+  /**
+   * Invokes the post response plugins.
+   */
+  private void invokePostResponsePlugins()
+  {
+    // Get the plugin config manager that will be used for invoking plugins.
+    PluginConfigManager pluginConfigManager =
+      DirectoryServer.getPluginConfigManager();
+
+    // Invoke the post response plugins that have been registered with
+    // the current operation
+    pluginConfigManager.invokePostResponseSearchPlugins(this);
+  }
+
+
   /**
    * Updates the error message and the result code of the operation.
    *
diff --git a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
index f440150..d7470cf 100644
--- a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
+++ b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
@@ -272,11 +272,10 @@
       }
 
 
-      // Check for and handle a request to cancel this operation.
+      // Check for a request to cancel this operation.
       if (localOp.getCancelRequest() != null)
       {
-        localOp.indicateCancelled(localOp.getCancelRequest());
-        localOp.setProcessingStopTime();
+        return;
       }
 
       // Acquire a write lock on the target entry.
@@ -304,11 +303,9 @@
 
       try
       {
-        // Check for and handle a request to cancel this operation.
+        // Check for a request to cancel this operation.
         if (localOp.getCancelRequest() != null)
         {
-          localOp.indicateCancelled(localOp.getCancelRequest());
-          localOp.setProcessingStopTime();
           return;
         }
 
@@ -2000,11 +1997,9 @@
         }
 
 
-        // Check for and handle a request to cancel this operation.
+        // Check for a request to cancel this operation.
         if (localOp.getCancelRequest() != null)
         {
-          localOp.indicateCancelled(localOp.getCancelRequest());
-          localOp.setProcessingStopTime();
           return;
         }
 
@@ -2040,11 +2035,9 @@
         }
 
 
-        // Check for and handle a request to cancel this operation.
+        // Check for a request to cancel this operation.
         if (localOp.getCancelRequest() != null)
         {
-          localOp.indicateCancelled(localOp.getCancelRequest());
-          localOp.setProcessingStopTime();
           return;
         }
 
@@ -2905,11 +2898,9 @@
         break searchProcessing;
       }
 
-      // Check for and handle a request to cancel this operation.
+      // Check for a request to cancel this operation.
       if (localOp.getCancelRequest() != null)
       {
-        localOp.indicateCancelled(localOp.getCancelRequest());
-        localOp.setProcessingStopTime();
         return;
       }
 
@@ -2941,11 +2932,9 @@
       }
 
 
-      // Check for and handle a request to cancel this operation.
+      // Check for a request to cancel this operation.
       if (localOp.getCancelRequest() != null)
       {
-        localOp.indicateCancelled(localOp.getCancelRequest());
-        localOp.setProcessingStopTime();
         return;
       }
 
@@ -3056,11 +3045,9 @@
     }
 
 
-    // Check for and handle a request to cancel this operation.
+    // Check for a request to cancel this operation.
     if (localOp.getCancelRequest() != null)
     {
-      localOp.indicateCancelled(localOp.getCancelRequest());
-      localOp.setProcessingStopTime();
       return;
     }
 
@@ -3262,7 +3249,6 @@
               int msgID = MSGID_CANCELED_BY_PREOP_DISCONNECT;
               localOp.appendErrorMessage(getMessage(msgID));
 
-              localOp.setProcessingStopTime();
               return;
             }
             else if (preOpResult.sendResponseImmediately())
@@ -3587,7 +3573,6 @@
               int msgID = MSGID_CANCELED_BY_PREOP_DISCONNECT;
               localOp.appendErrorMessage(getMessage(msgID));
 
-              localOp.setProcessingStopTime();
               return;
             }
             else if (preOpResult.sendResponseImmediately())
@@ -3885,7 +3870,6 @@
             int msgID = MSGID_CANCELED_BY_PREOP_DISCONNECT;
             localOp.appendErrorMessage(getMessage(msgID));
 
-            localOp.setProcessingStopTime();
             return;
           }
           else if (preOpResult.sendResponseImmediately())
@@ -4420,7 +4404,6 @@
         int msgID = MSGID_CANCELED_BY_PREOP_DISCONNECT;
         localOp.appendErrorMessage(getMessage(msgID));
 
-        localOp.setProcessingStopTime();
         return;
       }
     }
@@ -4524,11 +4507,9 @@
          DirectoryServer.getPluginConfigManager();
     boolean skipPostOperation = false;
 
-    // Check for and handle a request to cancel this operation.
+    // Check for a request to cancel this operation.
     if (localOp.getCancelRequest() != null)
     {
-      localOp.indicateCancelled(localOp.getCancelRequest());
-      localOp.setProcessingStopTime();
       return;
     }
 
@@ -4557,11 +4538,9 @@
         break addProcessing;
       }
 
-      // Check for and handle a request to cancel this operation.
+      // Check for a request to cancel this operation.
       if (localOp.getCancelRequest() != null)
       {
-        localOp.indicateCancelled(localOp.getCancelRequest());
-        localOp.setProcessingStopTime();
         return;
       }
 
@@ -4625,11 +4604,9 @@
 
       try
       {
-        // Check for and handle a request to cancel this operation.
+        // Check for a request to cancel this operation.
         if (localOp.getCancelRequest() != null)
         {
-          localOp.indicateCancelled(localOp.getCancelRequest());
-          localOp.setProcessingStopTime();
           return;
         }
 
@@ -5552,11 +5529,9 @@
           break addProcessing;
         }
 
-        // Check for and handle a request to cancel this operation.
+        // Check for a request to cancel this operation.
         if (localOp.getCancelRequest() != null)
         {
-          localOp.indicateCancelled(localOp.getCancelRequest());
-          localOp.setProcessingStopTime();
           return;
         }
 
@@ -5576,7 +5551,6 @@
             int msgID = MSGID_CANCELED_BY_PREOP_DISCONNECT;
             localOp.appendErrorMessage(getMessage(msgID));
 
-            localOp.setProcessingStopTime();
             return;
           }
           else if (preOpResult.sendResponseImmediately())
@@ -5592,11 +5566,9 @@
         }
 
 
-        // Check for and handle a request to cancel this operation.
+        // Check for a request to cancel this operation.
         if (localOp.getCancelRequest() != null)
         {
-          localOp.indicateCancelled(localOp.getCancelRequest());
-          localOp.setProcessingStopTime();
           return;
         }
 
@@ -5857,7 +5829,6 @@
         int msgID = MSGID_CANCELED_BY_PREOP_DISCONNECT;
         localOp.appendErrorMessage(getMessage(msgID));
 
-        localOp.setProcessingStopTime();
         return;
       }
     }
@@ -5889,11 +5860,6 @@
         }
       }
     }
-
-
-    // Stop the processing timer.
-    localOp.setProcessingStopTime();
-
   }
 
 
@@ -5922,11 +5888,9 @@
          DirectoryServer.getPluginConfigManager();
     boolean skipPostOperation = false;
 
-    // Check for and handle a request to cancel this operation.
+    // Check for a request to cancel this operation.
     if (localOp.getCancelRequest() != null)
     {
-      localOp.indicateCancelled(localOp.getCancelRequest());
-      localOp.setProcessingStopTime();
       return;
     }
 
@@ -6355,11 +6319,9 @@
           break deleteProcessing;
         }
 
-        // Check for and handle a request to cancel this operation.
+        // Check for a request to cancel this operation.
         if (localOp.getCancelRequest() != null)
         {
-          localOp.indicateCancelled(localOp.getCancelRequest());
-          localOp.setProcessingStopTime();
           return;
         }
 
@@ -6395,11 +6357,9 @@
         }
 
 
-        // Check for and handle a request to cancel this operation.
+        // Check for a request to cancel this operation.
         if (localOp.getCancelRequest() != null)
         {
-          localOp.indicateCancelled(localOp.getCancelRequest());
-          localOp.setProcessingStopTime();
           return;
         }
 
@@ -6741,7 +6701,7 @@
     ClientConnection clientConnection = localOp.getClientConnection();
 
 
-    // Check for and handle a request to cancel this operation.
+    // Check for a request to cancel this operation.
     if (localOp.getCancelRequest() != null)
     {
       return;
@@ -6775,7 +6735,7 @@
       }
 
 
-      // Check for and handle a request to cancel this operation.
+      // Check for a request to cancel this operation.
       if (localOp.getCancelRequest() != null)
       {
         return;
@@ -7131,7 +7091,7 @@
           break compareProcessing;
         }
 
-        // Check for and handle a request to cancel this operation.
+        // Check for a request to cancel this operation.
         if (localOp.getCancelRequest() != null)
         {
           return;
@@ -7256,7 +7216,7 @@
     }
 
 
-    // Check for and handle a request to cancel this operation.
+    // Check for a request to cancel this operation.
     if (localOp.getCancelRequest() != null)
     {
       return;
@@ -7307,10 +7267,9 @@
          DirectoryServer.getPluginConfigManager();
     boolean skipPostOperation = false;
 
-    // Check for and handle a request to cancel this operation.
+    // Check for a request to cancel this operation.
     if (op.getCancelRequest() != null)
     {
-      op.indicateCancelled(op.getCancelRequest());
       return;
     }
 
@@ -7390,10 +7349,9 @@
       }
 
 
-      // Check for and handle a request to cancel this operation.
+      // Check for a request to cancel this operation.
       if (op.getCancelRequest() != null)
       {
-        op.indicateCancelled(op.getCancelRequest());
         return;
       }
 
@@ -7471,10 +7429,9 @@
       Entry currentEntry = null;
       try
       {
-        // Check for and handle a request to cancel this operation.
+        // Check for a request to cancel this operation.
         if (op.getCancelRequest() != null)
         {
-          op.indicateCancelled(op.getCancelRequest());
           return;
         }
 
@@ -8025,10 +7982,9 @@
         }
 
 
-        // Check for and handle a request to cancel this operation.
+        // Check for a request to cancel this operation.
         if (op.getCancelRequest() != null)
         {
-          op.indicateCancelled(op.getCancelRequest());
           return;
         }
 
@@ -8253,10 +8209,9 @@
         }
 
 
-        // Check for and handle a request to cancel this operation.
+        // Check for a request to cancel this operation.
         if (op.getCancelRequest() != null)
         {
-          op.indicateCancelled(op.getCancelRequest());
           return;
         }
 

--
Gitblit v1.10.0