| | |
| | | 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; |
| | |
| | | */ |
| | | 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; |
| | | |
| | |
| | | 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; |
| | |
| | | |
| | | |
| | | |
| | | 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> |
| | |
| | | { |
| | | registeredConfiguration = configuration; |
| | | configuration.addSoftReferenceChangeListener (this); |
| | | configEntryDN = configuration.dn(); |
| | | |
| | | dnMap.clear(); |
| | | idMap.clear(); |
| | |
| | | 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 |
| | | ); |
| | |
| | | |
| | | if (applyChanges && errorHandler.getIsAcceptable()) |
| | | { |
| | | configEntryDN = newConfigEntryDN; |
| | | |
| | | setLockTimeout(newLockTimeout); |
| | | setIncludeFilters(newIncludeFilters); |
| | | setExcludeFilters(newExcludeFilters); |