Skip to content
Snippets Groups Projects
Commit bd54529a authored by Tobias Pietzsch's avatar Tobias Pietzsch
Browse files

rename finalizeRemovedCacheEntries() to cleanUp() (consistent with guava).

add javadoc
parent 0a174863
No related branches found
No related tags found
No related merge requests found
......@@ -205,7 +205,7 @@ public final class LoadingVolatileCache< K, V extends VolatileCacheValue > imple
public void prepareNextFrame()
{
queue.clear();
cache.finalizeRemovedCacheEntries();
cache.cleanUp();
++currentQueueFrame;
}
......
......@@ -9,7 +9,12 @@ public interface WeakSoftCache< K, V >
public V get( final Object key );
public void finalizeRemovedCacheEntries(); // TODO: rename to cleanUp() ?
/**
* Performs pending maintenance operations needed by the cache. Exactly
* which activities are performed is implementation-dependent. This should
* be called periodically
*/
public void cleanUp();
public void clearCache();
......
......@@ -9,7 +9,7 @@ import java.util.concurrent.ConcurrentHashMap;
//TODO: rename, refactor, document
public class WeakSoftCacheImp< K, V > implements WeakSoftCache< K, V >
{
private static final int MAX_PER_FRAME_FINALIZE_ENTRIES = 500; // TODO rename
public static final int MAX_PER_FRAME_FINALIZE_ENTRIES = 500;
private final ConcurrentHashMap< K, Reference< V > > softReferenceCache = new ConcurrentHashMap<>();
......@@ -45,8 +45,13 @@ public class WeakSoftCacheImp< K, V > implements WeakSoftCache< K, V >
softReferenceCache.clear();
}
/**
* Remove references from the cache that have been garbage-collected.
* To avoid long run-times, per call to {@code cleanUp()}, at most
* {@link #MAX_PER_FRAME_FINALIZE_ENTRIES} are processed.
*/
@Override
public void finalizeRemovedCacheEntries()
public void cleanUp()
{
synchronized ( softReferenceCache )
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment