/** * Iterates through the cache and cleans up any cache references that have * been collected by the garbage collector. */ public final void cleanup() { mbean.cleanups.incrementAndGet(); if(log.isTraceEnabled()) { log.trace("cleanup() called on {} of size: {}", getName(), cacheEntries.size()); } int i = 0; Reference<? extends V> ref = referenceQueue.poll(); while (ref != null) { i++; assert ref.get() == null : "Referent should be null by the time the Reference is added to the queue"; removeReference(ref); ref = referenceQueue.poll(); } if(log.isTraceEnabled()) { log.trace("cleanup() finished on {}. {} keys were cleaned up. ", getName(), i); } }
/** * Iterates through the cache and cleans up any cache references that have * been collected by the garbage collector. */ public final void cleanup() { mbean.cleanups.incrementAndGet(); if(log.isTraceEnabled()) { log.trace("cleanup() called on {} of size: {}", getName(), cacheEntries.size()); } int i = 0; Reference<? extends V> ref = referenceQueue.poll(); while (ref != null) { i++; assert ref.get() == null : "Referent should be null by the time the Reference is added to the queue"; removeReference(ref); ref = referenceQueue.poll(); } if(log.isTraceEnabled()) { log.trace("cleanup() finished on {}. {} keys were cleaned up. ", getName(), i); } }