From 47be44124da7f6ad42bed03a24701ca07c00918d Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Wed, 12 Sep 2007 00:03:02 +0000
Subject: [PATCH] Make a couple of changes to help improve server performance:

---
 opends/src/server/org/opends/server/extensions/ConfigFileHandler.java |   30 +++++-------------------------
 1 files changed, 5 insertions(+), 25 deletions(-)

diff --git a/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java b/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
index 3021309..53f47d4 100644
--- a/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
+++ b/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
@@ -53,7 +53,6 @@
 import java.util.zip.ZipOutputStream;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.locks.ReentrantLock;
 import javax.crypto.Mac;
 
 import org.opends.messages.Message;
@@ -155,7 +154,7 @@
 
   // The write lock used to ensure that only one thread can apply a
   // configuration update at any given time.
-  private ReentrantLock configLock;
+  private Object configLock;
 
   // The path to the configuration file.
   private String configFile;
@@ -196,7 +195,7 @@
          throws InitializationException
   {
     // Initialize the config lock.
-    configLock = new ReentrantLock();
+    configLock = new Object();
 
 
     // Determine whether we should try to start using the last known good
@@ -1276,9 +1275,7 @@
 
     // Grab the config lock to ensure that only one config update may be in
     // progress at any given time.
-    configLock.lock();
-
-    try
+    synchronized (configLock)
     {
       // Make sure that the target DN does not already exist.  If it does, then
       // fail.
@@ -1414,10 +1411,6 @@
         throw new DirectoryException(resultCode, message);
       }
     }
-    finally
-    {
-      configLock.unlock();
-    }
   }
 
 
@@ -1456,9 +1449,7 @@
 
     // Grab the config lock to ensure that only one config update may be in
     // progress at any given time.
-    configLock.lock();
-
-    try
+    synchronized (configLock)
     {
       // Get the target entry.  If it does not exist, then fail.
       ConfigEntry entry = configEntries.get(entryDN);
@@ -1590,10 +1581,6 @@
         throw new DirectoryException(resultCode, message);
       }
     }
-    finally
-    {
-      configLock.unlock();
-    }
   }
 
 
@@ -1656,10 +1643,7 @@
 
     // Grab the config lock to ensure that only one config update may be in
     // progress at any given time.
-    configLock.lock();
-
-
-    try
+    synchronized (configLock)
     {
       // Get the DN of the target entry for future reference.
       DN entryDN = e.getDN();
@@ -1773,10 +1757,6 @@
         throw new DirectoryException(resultCode, message);
       }
     }
-    finally
-    {
-      configLock.unlock();
-    }
   }
 
 

--
Gitblit v1.10.0