From d7983b7e6eef579bc5f86cefa6932fecc7aec7bd Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Tue, 04 Sep 2007 16:01:28 +0000
Subject: [PATCH] entry cache cleanup: - remove obsolete methods, fields and messages. - aggregate filters evaluation for config phases. - simplify filters evaluation and error reporting. - use a single set of filter messages.

---
 opends/src/server/org/opends/server/extensions/SoftReferenceEntryCache.java |   49 ++++---------------------------------------------
 1 files changed, 4 insertions(+), 45 deletions(-)

diff --git a/opends/src/server/org/opends/server/extensions/SoftReferenceEntryCache.java b/opends/src/server/org/opends/server/extensions/SoftReferenceEntryCache.java
index d517506..ae8e5ba 100644
--- a/opends/src/server/org/opends/server/extensions/SoftReferenceEntryCache.java
+++ b/opends/src/server/org/opends/server/extensions/SoftReferenceEntryCache.java
@@ -34,7 +34,6 @@
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
 import org.opends.messages.MessageBuilder;
@@ -80,13 +79,6 @@
    */
   private static final DebugTracer TRACER = getTracer();
 
-
-
-  // The set of time units that will be used for expressing the task retention
-  // time.
-  private static final LinkedHashMap<String,Double> timeUnits =
-       new LinkedHashMap<String,Double>();
-
   // The mapping between entry DNs and their corresponding entries.
   private ConcurrentHashMap<DN,SoftReference<CacheEntry>> dnMap;
 
@@ -94,9 +86,6 @@
   private ConcurrentHashMap<Backend,
                ConcurrentHashMap<Long,SoftReference<CacheEntry>>> idMap;
 
-  // The DN of the configuration entry for this entry cache implementation.
-  private DN configEntryDN;
-
   // The reference queue that will be used to notify us whenever a soft
   // reference is freed.
   private ReferenceQueue<CacheEntry> referenceQueue;
@@ -110,16 +99,6 @@
 
 
 
-  static
-  {
-    timeUnits.put(TIME_UNIT_MILLISECONDS_ABBR, 1D);
-    timeUnits.put(TIME_UNIT_MILLISECONDS_FULL, 1D);
-    timeUnits.put(TIME_UNIT_SECONDS_ABBR, 1000D);
-    timeUnits.put(TIME_UNIT_SECONDS_FULL, 1000D);
-  }
-
-
-
   /**
    * Creates a new instance of this soft reference entry cache.  All
    * initialization should be performed in the <CODE>initializeEntryCache</CODE>
@@ -156,7 +135,6 @@
   {
     registeredConfiguration = configuration;
     configuration.addSoftReferenceChangeListener (this);
-    configEntryDN = configuration.dn();
 
     dnMap.clear();
     idMap.clear();
@@ -580,34 +558,17 @@
     switch (errorHandler.getConfigPhase())
     {
     case PHASE_INIT:
+    case PHASE_ACCEPTABLE:
+    case PHASE_APPLY:
       newIncludeFilters = EntryCacheCommon.getFilters (
           configuration.getIncludeFilter(),
-          ERR_SOFTREFCACHE_INVALID_INCLUDE_FILTER,
-          WARN_SOFTREFCACHE_CANNOT_DECODE_ANY_INCLUDE_FILTERS,
+          ERR_CACHE_INVALID_INCLUDE_FILTER,
           errorHandler,
           newConfigEntryDN
           );
       newExcludeFilters = EntryCacheCommon.getFilters (
           configuration.getExcludeFilter(),
-          WARN_SOFTREFCACHE_CANNOT_DECODE_EXCLUDE_FILTER,
-          WARN_SOFTREFCACHE_CANNOT_DECODE_ANY_EXCLUDE_FILTERS,
-          errorHandler,
-          newConfigEntryDN
-          );
-      break;
-    case PHASE_ACCEPTABLE:  // acceptable and apply are using the same
-    case PHASE_APPLY:       // error ID codes
-      newIncludeFilters = EntryCacheCommon.getFilters (
-          configuration.getIncludeFilter(),
-          ERR_SOFTREFCACHE_INVALID_INCLUDE_FILTER,
-          null,
-          errorHandler,
-          newConfigEntryDN
-          );
-      newExcludeFilters = EntryCacheCommon.getFilters (
-          configuration.getExcludeFilter(),
-          ERR_SOFTREFCACHE_INVALID_EXCLUDE_FILTER,
-          null,
+          ERR_CACHE_INVALID_EXCLUDE_FILTER,
           errorHandler,
           newConfigEntryDN
           );
@@ -616,8 +577,6 @@
 
     if (applyChanges && errorHandler.getIsAcceptable())
     {
-      configEntryDN = newConfigEntryDN;
-
       setLockTimeout(newLockTimeout);
       setIncludeFilters(newIncludeFilters);
       setExcludeFilters(newExcludeFilters);

--
Gitblit v1.10.0