Skip to content

Commit

Permalink
Fixed CleanUpThread to only remove the gc'd entry and not empty out t…
Browse files Browse the repository at this point in the history
…he entire cache
  • Loading branch information
Inderbir Singh Pall committed Mar 12, 2011
1 parent e6c0705 commit ff1a9eb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion LRUCache/src/CleanUpThread.java
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ public void run() {


while (it.hasNext()) { while (it.hasNext()) {
K key = it.next(); K key = it.next();
if (cache.get(key) == ref.get()) {
System.out.println("CleanupThread :: cleaning key =" + key + " value = "+ cache.get(key) + " from softCache"); System.out.println("CleanupThread :: cleaning key =" + key + " value = "+ cache.get(key) + " from softCache");
cache.remove(key); cache.remove(key);

}
} }


} }
Expand Down

0 comments on commit ff1a9eb

Please sign in to comment.