activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1227183 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/LRUCache.java
Date Wed, 04 Jan 2012 15:12:58 GMT
Author: chirino
Date: Wed Jan  4 15:12:58 2012
New Revision: 1227183

URL: http://svn.apache.org/viewvc?rev=1227183&view=rev
Log:
Allow LRUCache subclasses to trap eviction events

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/LRUCache.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/LRUCache.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/LRUCache.java?rev=1227183&r1=1227182&r2=1227183&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/LRUCache.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/LRUCache.java Wed
Jan  4 15:12:58 2012
@@ -80,6 +80,14 @@ public class LRUCache<K, V> extends Link
     }
 
     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) {
+    }
+
 }



Mime
View raw message