Permalink
Browse files

Fixed CleanUpThread to only remove the gc'd entry and not empty out t…

…he entire cache
  • Loading branch information...
1 parent e6c0705 commit ff1a9eb2bab1298289c4553b8164fdd94882bccf Inderbir Singh Pall committed Mar 12, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 LRUCache/src/CleanUpThread.java
@@ -29,9 +29,10 @@ public void run() {
while (it.hasNext()) {
K key = it.next();
+ if (cache.get(key) == ref.get()) {
System.out.println("CleanupThread :: cleaning key =" + key + " value = "+ cache.get(key) + " from softCache");
cache.remove(key);
-
+ }
}
}

0 comments on commit ff1a9eb

Please sign in to comment.