| | |
| | | { |
| | | map = new ConcurrentHashMap<Long,SoftReference<CacheEntry>>(); |
| | | map.put(entryID, ref); |
| | | idMap.put(backend, map); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | ref.clear(); |
| | | } |
| | | // If this backend becomes empty now remove |
| | | // it from the idMap map. |
| | | if (map.isEmpty()) |
| | | { |
| | | idMap.remove(backend); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public String toVerboseString() |
| | | { |
| | | String verboseString = new String(); |
| | | |
| | | // There're no locks in this cache to keep dnMap and idMap in |
| | | // sync. Examine dnMap only since its more likely to be up to |
| | | // date than idMap. Dont bother with copies either since this |
| | | // is SoftReference based implementation. |
| | | for(SoftReference<CacheEntry> ce : dnMap.values()) { |
| | | verboseString = verboseString + ce.get().getDN().toString() + |
| | | ":" + Long.toString(ce.get().getEntryID()) + ":" + |
| | | ce.get().getBackend().getBackendID() + "\n"; |
| | | } |
| | | |
| | | return (verboseString.length() > 0 ? verboseString : null); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override() |
| | | public boolean isConfigurationAcceptable(EntryCacheCfg configuration, |
| | | List<Message> unacceptableReasons) |
| | |
| | | { |
| | | ref.clear(); |
| | | |
| | | Backend backend = freedEntry.getBackend(); |
| | | ConcurrentHashMap<Long,SoftReference<CacheEntry>> map = |
| | | idMap.get(freedEntry.getBackend()); |
| | | idMap.get(backend); |
| | | if (map != null) |
| | | { |
| | | ref = map.remove(freedEntry.getEntryID()); |
| | |
| | | { |
| | | ref.clear(); |
| | | } |
| | | // If this backend becomes empty now remove |
| | | // it from the idMap map. |
| | | if (map.isEmpty()) { |
| | | idMap.remove(backend); |
| | | } |
| | | } |
| | | } |
| | | } |