| | |
| | | import java.lang.ref.SoftReference; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | |
| | | import org.opends.server.config.ConfigAttribute; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.config.IntegerConfigAttribute; |
| | | import org.opends.server.config.IntegerWithUnitConfigAttribute; |
| | | import org.opends.server.config.StringConfigAttribute; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.InitializationException; |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 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; |
| | | |
| | |
| | | |
| | | |
| | | |
| | | static |
| | | { |
| | | timeUnits.put("ms", 1.0); |
| | | timeUnits.put("s", 1000.0); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this soft reference entry cache. All |
| | | * initialization should be performed in the <CODE>initializeEntryCache</CODE> |
| | |
| | | |
| | | // Determine the lock timeout to use when interacting with the lock manager. |
| | | int msgID = MSGID_SOFTREFCACHE_DESCRIPTION_LOCK_TIMEOUT; |
| | | IntegerConfigAttribute lockTimeoutStub = |
| | | new IntegerConfigAttribute(ATTR_SOFTREFCACHE_LOCK_TIMEOUT, |
| | | getMessage(msgID), true, false, false, |
| | | true, 0, false, 0); |
| | | IntegerWithUnitConfigAttribute lockTimeoutStub = |
| | | new IntegerWithUnitConfigAttribute(ATTR_SOFTREFCACHE_LOCK_TIMEOUT, |
| | | getMessage(msgID), false, timeUnits, |
| | | true, 0, false, 0); |
| | | try |
| | | { |
| | | IntegerConfigAttribute lockTimeoutAttr = |
| | | (IntegerConfigAttribute) |
| | | IntegerWithUnitConfigAttribute lockTimeoutAttr = |
| | | (IntegerWithUnitConfigAttribute) |
| | | configEntry.getConfigAttribute(lockTimeoutStub); |
| | | if (lockTimeoutAttr == null) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | lockTimeout = lockTimeoutAttr.activeValue(); |
| | | lockTimeout = lockTimeoutAttr.activeCalculatedValue(); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | |
| | | |
| | | |
| | | int msgID = MSGID_SOFTREFCACHE_DESCRIPTION_LOCK_TIMEOUT; |
| | | IntegerConfigAttribute lockTimeoutAttr = |
| | | new IntegerConfigAttribute(ATTR_SOFTREFCACHE_LOCK_TIMEOUT, |
| | | getMessage(msgID), true, false, false, |
| | | true, 0, false, 0, lockTimeout); |
| | | IntegerWithUnitConfigAttribute lockTimeoutAttr = |
| | | new IntegerWithUnitConfigAttribute(ATTR_SOFTREFCACHE_LOCK_TIMEOUT, |
| | | getMessage(msgID), false, timeUnits, |
| | | true, 0, false, 0, lockTimeout, |
| | | "ms"); |
| | | attrList.add(lockTimeoutAttr); |
| | | |
| | | |
| | |
| | | |
| | | // Determine the lock timeout to use when interacting with the lock manager. |
| | | int msgID = MSGID_SOFTREFCACHE_DESCRIPTION_LOCK_TIMEOUT; |
| | | IntegerConfigAttribute lockTimeoutStub = |
| | | new IntegerConfigAttribute(ATTR_SOFTREFCACHE_LOCK_TIMEOUT, |
| | | getMessage(msgID), true, false, false, |
| | | true, 0, false, 0); |
| | | IntegerWithUnitConfigAttribute lockTimeoutStub = |
| | | new IntegerWithUnitConfigAttribute(ATTR_SOFTREFCACHE_LOCK_TIMEOUT, |
| | | getMessage(msgID), false, timeUnits, |
| | | true, 0, false, 0); |
| | | try |
| | | { |
| | | IntegerConfigAttribute lockTimeoutAttr = |
| | | (IntegerConfigAttribute) |
| | | IntegerWithUnitConfigAttribute lockTimeoutAttr = |
| | | (IntegerWithUnitConfigAttribute) |
| | | configEntry.getConfigAttribute(lockTimeoutStub); |
| | | } |
| | | catch (Exception e) |
| | |
| | | // Determine the lock timeout to use when interacting with the lock manager. |
| | | long newLockTimeout = LockManager.DEFAULT_TIMEOUT; |
| | | int msgID = MSGID_SOFTREFCACHE_DESCRIPTION_LOCK_TIMEOUT; |
| | | IntegerConfigAttribute lockTimeoutStub = |
| | | new IntegerConfigAttribute(ATTR_SOFTREFCACHE_LOCK_TIMEOUT, |
| | | getMessage(msgID), true, false, false, |
| | | true, 0, false, 0); |
| | | IntegerWithUnitConfigAttribute lockTimeoutStub = |
| | | new IntegerWithUnitConfigAttribute(ATTR_SOFTREFCACHE_LOCK_TIMEOUT, |
| | | getMessage(msgID), false, timeUnits, |
| | | true, 0, false, 0); |
| | | try |
| | | { |
| | | IntegerConfigAttribute lockTimeoutAttr = |
| | | (IntegerConfigAttribute) |
| | | IntegerWithUnitConfigAttribute lockTimeoutAttr = |
| | | (IntegerWithUnitConfigAttribute) |
| | | configEntry.getConfigAttribute(lockTimeoutStub); |
| | | if (lockTimeoutAttr != null) |
| | | { |
| | | newLockTimeout = lockTimeoutAttr.pendingValue(); |
| | | newLockTimeout = lockTimeoutAttr.pendingCalculatedValue(); |
| | | } |
| | | } |
| | | catch (Exception e) |