Allow LRUCache subclasses to trap eviction events

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1227183 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2012-01-04 15:12:58 +00:00
parent 78761cb348
commit d95658f4b4
1 changed files with 9 additions and 1 deletions

View File

@ -80,6 +80,14 @@ public class LRUCache<K, V> extends LinkedHashMap<K, V> {
} }
protected boolean removeEldestEntry(Map.Entry<K,V> eldest) { protected boolean removeEldestEntry(Map.Entry<K,V> eldest) {
return size() > maxCacheSize; if( size() > maxCacheSize ) {
onCacheEviction(eldest);
return true;
}
return false;
} }
protected void onCacheEviction(Map.Entry<K,V> eldest) {
}
} }