| | |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.CacheEntry; |
| | | import org.opends.server.types.ConfigChangeResult; |
| | | import org.opends.server.types.DebugLogLevel; |
| | |
| | | SoftReference<CacheEntry> ref = dnMap.get(entryDN); |
| | | if (ref == null) |
| | | { |
| | | // Indicate cache miss. |
| | | cacheMisses.set(cacheMisses.incrementAndGet()); |
| | | return null; |
| | | } |
| | | else |
| | |
| | | CacheEntry cacheEntry = ref.get(); |
| | | if (cacheEntry == null) |
| | | { |
| | | // Indicate cache miss. |
| | | cacheMisses.set(cacheMisses.incrementAndGet()); |
| | | return null; |
| | | } |
| | | else |
| | | { |
| | | // Indicate cache hit. |
| | | cacheHits.set(cacheHits.incrementAndGet()); |
| | | return cacheEntry.getEntry(); |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | public ArrayList<Attribute> getMonitorData() |
| | | { |
| | | ArrayList<Attribute> attrs = new ArrayList<Attribute>(); |
| | | |
| | | try { |
| | | attrs = EntryCacheCommon.getGenericMonitorData( |
| | | new Long(cacheHits.longValue()), |
| | | new Long(cacheMisses.longValue()), |
| | | null, |
| | | null, |
| | | new Long(dnMap.size()), |
| | | null |
| | | ); |
| | | } catch (Exception e) { |
| | | if (debugEnabled()) { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | } |
| | | |
| | | return attrs; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Return a verbose string representation of the current cache maps. |
| | | * This is useful primary for debugging and diagnostic purposes such |
| | | * as in the entry cache unit tests. |