cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r901854 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra: cache/ net/ service/ utils/
Date Thu, 21 Jan 2010 21:03:28 GMT
Author: jbellis
Date: Thu Jan 21 21:03:27 2010
New Revision: 901854

URL: http://svn.apache.org/viewvc?rev=901854&view=rev
Log:
rename Cachetable -> ExpiringMap.  patch by jbellis

Added:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/ExpiringMap.java   (contents,
props changed)
      - copied, changed from r901748, incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/Cachetable.java
Removed:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/cache/ICachetable.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/Cachetable.java
Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/AntiEntropyService.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyManager.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ReadRepairManager.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java?rev=901854&r1=901853&r2=901854&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java Thu
Jan 21 21:03:27 2010
@@ -18,7 +18,6 @@
 
 package org.apache.cassandra.net;
 
-import org.apache.cassandra.cache.ICachetable;
 import org.apache.cassandra.concurrent.*;
 import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.gms.FailureDetector;
@@ -56,8 +55,8 @@
     public static final String responseVerbHandler_ = "RESPONSE";
 
     /* This records all the results mapped by message Id */
-    private static ICachetable<String, IAsyncCallback> callbackMap_;
-    private static ICachetable<String, IAsyncResult> taskCompletionMap_;
+    private static ExpiringMap<String, IAsyncCallback> callbackMap_;
+    private static ExpiringMap<String, IAsyncResult> taskCompletionMap_;
     
     /* Lookup table for registering message handlers based on the verb. */
     private static Map<String, IVerbHandler> verbHandlers_;
@@ -94,8 +93,8 @@
          * which is the sum of the threads in the pool that adds shit into the table and
the 
          * pool that retrives the callback from here.
         */
-        callbackMap_ = new Cachetable<String, IAsyncCallback>( 2 * DatabaseDescriptor.getRpcTimeout()
);
-        taskCompletionMap_ = new Cachetable<String, IAsyncResult>( 2 * DatabaseDescriptor.getRpcTimeout()
);        
+        callbackMap_ = new ExpiringMap<String, IAsyncCallback>( 2 * DatabaseDescriptor.getRpcTimeout()
);
+        taskCompletionMap_ = new ExpiringMap<String, IAsyncResult>( 2 * DatabaseDescriptor.getRpcTimeout()
);
 
         // read executor puts messages to deserialize on this.
         messageDeserializerExecutor_ = new JMXEnabledThreadPoolExecutor(1,

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/AntiEntropyService.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/AntiEntropyService.java?rev=901854&r1=901853&r2=901854&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/AntiEntropyService.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/AntiEntropyService.java
Thu Jan 21 21:03:27 2010
@@ -113,7 +113,7 @@
      *
      * This map is only accessed from AE_SERVICE_STAGE, so it is not synchronized.
      */
-    private final Map<CFPair, Cachetable<InetAddress, TreePair>> trees;
+    private final Map<CFPair, ExpiringMap<InetAddress, TreePair>> trees;
 
     /**
      * Protected constructor. Use AntiEntropyService.instance.
@@ -123,7 +123,7 @@
         MessagingService.instance.registerVerbHandlers(TREE_REQUEST_VERB, new TreeRequestVerbHandler());
         MessagingService.instance.registerVerbHandlers(TREE_RESPONSE_VERB, new TreeResponseVerbHandler());
         naturalRepairs = new ConcurrentHashMap<CFPair, Long>();
-        trees = new HashMap<CFPair, Cachetable<InetAddress, TreePair>>();
+        trees = new HashMap<CFPair, ExpiringMap<InetAddress, TreePair>>();
     }
 
     /**
@@ -133,12 +133,12 @@
      * @param cf Column family to fetch trees for.
      * @return The store of trees for the given cf.
      */
-    private Cachetable<InetAddress, TreePair> rendezvousPairs(CFPair cf)
+    private ExpiringMap<InetAddress, TreePair> rendezvousPairs(CFPair cf)
     {
-        Cachetable<InetAddress, TreePair> ctrees = trees.get(cf);
+        ExpiringMap<InetAddress, TreePair> ctrees = trees.get(cf);
         if (ctrees == null)
         {
-            ctrees = new Cachetable<InetAddress, TreePair>(TREE_STORE_TIMEOUT);
+            ctrees = new ExpiringMap<InetAddress, TreePair>(TREE_STORE_TIMEOUT);
             trees.put(cf, ctrees);
         }
         return ctrees;
@@ -168,7 +168,7 @@
         InetAddress LOCAL = FBUtilities.getLocalAddress();
 
         // return the rendezvous pairs for this cf
-        Cachetable<InetAddress, TreePair> ctrees = rendezvousPairs(cf);
+        ExpiringMap<InetAddress, TreePair> ctrees = rendezvousPairs(cf);
 
         List<Differencer> differencers = new ArrayList<Differencer>();
         if (LOCAL.equals(endpoint))

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyManager.java?rev=901854&r1=901853&r2=901854&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyManager.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ConsistencyManager.java
Thu Jan 21 21:03:27 2010
@@ -26,7 +26,6 @@
 import java.util.List;
 
 import org.apache.cassandra.cache.ICacheExpungeHook;
-import org.apache.cassandra.cache.ICachetable;
 import org.apache.cassandra.db.ReadCommand;
 import org.apache.cassandra.db.ReadResponse;
 import org.apache.cassandra.db.Row;
@@ -132,7 +131,7 @@
     }
 
 	private static long scheduledTimeMillis_ = 600;
-	private static ICachetable<String, String> readRepairTable_ = new Cachetable<String,
String>(scheduledTimeMillis_);
+	private static ExpiringMap<String, String> readRepairTable_ = new ExpiringMap<String,
String>(scheduledTimeMillis_);
 	private final Row row_;
 	protected final List<InetAddress> replicas_;
 	private final ReadCommand readCommand_;

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ReadRepairManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ReadRepairManager.java?rev=901854&r1=901853&r2=901854&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ReadRepairManager.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/ReadRepairManager.java
Thu Jan 21 21:03:27 2010
@@ -27,10 +27,9 @@
 
 import org.apache.cassandra.net.Message;
 import org.apache.cassandra.net.MessagingService;
-import org.apache.cassandra.utils.Cachetable;
+import org.apache.cassandra.utils.ExpiringMap;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.cache.ICacheExpungeHook;
-import org.apache.cassandra.cache.ICachetable;
 
 import org.apache.log4j.Logger;
 
@@ -78,7 +77,7 @@
 
 	}
 
-	private ICachetable<String, Message> readRepairTable_ = new Cachetable<String,
Message>(expirationTimeInMillis, new ReadRepairManager.ReadRepairPerformer());
+	private ExpiringMap<String, Message> readRepairTable_ = new ExpiringMap<String,
Message>(expirationTimeInMillis, new ReadRepairManager.ReadRepairPerformer());
 
 	protected ReadRepairManager()
 	{

Copied: incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/ExpiringMap.java (from
r901748, incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/Cachetable.java)
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/ExpiringMap.java?p2=incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/ExpiringMap.java&p1=incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/Cachetable.java&r1=901748&r2=901854&rev=901854&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/Cachetable.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/ExpiringMap.java Thu Jan
21 21:03:27 2010
@@ -23,9 +23,8 @@
 import org.apache.log4j.Logger;
 
 import org.apache.cassandra.cache.ICacheExpungeHook;
-import org.apache.cassandra.cache.ICachetable;
 
-public class Cachetable<K, V> implements ICachetable<K, V>
+public class ExpiringMap<K, V>
 {
     private class CacheableObject
     {
@@ -117,7 +116,7 @@
     private Map<K, ICacheExpungeHook<K, V>> hooks_;
     private Timer timer_;
     private static int counter_ = 0;
-    private static final Logger LOGGER = Logger.getLogger(Cachetable.class);
+    private static final Logger LOGGER = Logger.getLogger(ExpiringMap.class);
 
     private void init(long expiration)
     {
@@ -136,7 +135,7 @@
     * Specify the TTL for objects in the cache
     * in milliseconds.
     */
-    public Cachetable(long expiration)
+    public ExpiringMap(long expiration)
     {
         init(expiration);
     }
@@ -147,7 +146,7 @@
     * a key has a key-specific hook installed invoke that
     * instead.
     */
-    public Cachetable(long expiration, ICacheExpungeHook<K, V> global)
+    public ExpiringMap(long expiration, ICacheExpungeHook<K, V> global)
     {
         init(expiration);
         globalHook_ = global;

Propchange: incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/ExpiringMap.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message