cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1068223 - /cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/ExpiringMap.java
Date Mon, 07 Feb 2011 23:32:51 GMT
Author: jbellis
Date: Mon Feb  7 23:32:51 2011
New Revision: 1068223

URL: http://svn.apache.org/viewvc?rev=1068223&view=rev
Log:
add assert, fix generics
patch by jbellis

Modified:
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/ExpiringMap.java

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/ExpiringMap.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/ExpiringMap.java?rev=1068223&r1=1068222&r2=1068223&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/ExpiringMap.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/utils/ExpiringMap.java
Mon Feb  7 23:32:51 2011
@@ -39,6 +39,7 @@ public class ExpiringMap<K, V>
 
         CacheableObject(T o)
         {
+            assert o != null;
             value = o;
             age = System.currentTimeMillis();
         }
@@ -66,18 +67,18 @@ public class ExpiringMap<K, V>
         @Override
         public void run()
         {
-            for (Map.Entry<K, CacheableObject> entry : cache.entrySet())
+            for (Map.Entry<K, CacheableObject<V>> entry : cache.entrySet())
             {
                 if (entry.getValue().isReadyToDie(expiration))
                 {
                     cache.remove(entry.getKey());
-                    postExpireHook.apply(new Pair(entry.getKey(), entry.getValue().getValue()));
+                    postExpireHook.apply(new Pair<K, V>(entry.getKey(), entry.getValue().getValue()));
                 }
             }
         }
     }
 
-    private final NonBlockingHashMap<K, CacheableObject> cache = new NonBlockingHashMap<K,
CacheableObject>();
+    private final NonBlockingHashMap<K, CacheableObject<V>> cache = new NonBlockingHashMap<K,
CacheableObject<V>>();
     private final Timer timer;
     private static int counter = 0;
 



Mime
View raw message