From 4698e4fa18f652019b8f06fef1b2b8813446f5e0 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Wed, 03 Jan 2007 16:12:10 +0000
Subject: [PATCH] Update the task backend to properly acquire read locks on task and recurring task entries when evaluating them during search operations, and to acquire write locks for the entries when they are being updated.  This should eliminate the possibility of concurrent modification exceptions being thrown in cases where a client issues a search for a task entry at the same time the task entry is being updated within the server.

---
 opends/src/server/org/opends/server/backends/task/RecurringTask.java |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/task/RecurringTask.java b/opends/src/server/org/opends/server/backends/task/RecurringTask.java
index 703c7d4..fb6182c 100644
--- a/opends/src/server/org/opends/server/backends/task/RecurringTask.java
+++ b/opends/src/server/org/opends/server/backends/task/RecurringTask.java
@@ -37,6 +37,7 @@
 import org.opends.server.types.AttributeType;
 import org.opends.server.types.AttributeValue;
 import org.opends.server.types.DirectoryException;
+import org.opends.server.types.DN;
 import org.opends.server.types.Entry;
 import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
@@ -63,6 +64,9 @@
 
 
 
+  // The DN of the entry that actually defines this task.
+  private DN recurringTaskEntryDN;
+
   // The entry that actually defines this task.
   private Entry recurringTaskEntry;
 
@@ -97,8 +101,9 @@
     assert debugConstructor(CLASS_NAME, String.valueOf(taskScheduler),
                             String.valueOf(recurringTaskEntry));
 
-    this.taskScheduler      = taskScheduler;
-    this.recurringTaskEntry = recurringTaskEntry;
+    this.taskScheduler        = taskScheduler;
+    this.recurringTaskEntry   = recurringTaskEntry;
+    this.recurringTaskEntryDN = recurringTaskEntry.getDN();
 
 
     // Get the recurring task ID from the entry.  If there isn't one, then fail.
@@ -278,6 +283,20 @@
 
 
   /**
+   * Retrieves the DN of the entry containing the data for this recurring task.
+   *
+   * @return  The DN of the entry containing the data for this recurring task.
+   */
+  public DN getRecurringTaskEntryDN()
+  {
+    assert debugEnter(CLASS_NAME, "getRecurringTaskEntryDN");
+
+    return recurringTaskEntryDN;
+  }
+
+
+
+  /**
    * Retrieves the entry containing the data for this recurring task.
    *
    * @return  The entry containing the data for this recurring task.

--
Gitblit v1.10.0