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/workflowelement/localbackend/LocalBackendWorkflowElement.java |   95 ++++++++++++-----------------------------------
 1 files changed, 25 insertions(+), 70 deletions(-)

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