accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1398359 - in /accumulo/branches/1.4/src/server/src: main/java/org/apache/accumulo/server/tabletserver/ test/java/org/apache/accumulo/server/tabletserver/
Date Mon, 15 Oct 2012 16:13:58 GMT
Author: ecn
Date: Mon Oct 15 16:13:57 2012
New Revision: 1398359

URL: http://svn.apache.org/viewvc?rev=1398359&view=rev
Log:
ACCUMULO-774 re-use the apache commons LRUMap

Removed:
    accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/SimpleLRUCache.java
    accumulo/branches/1.4/src/server/src/test/java/org/apache/accumulo/server/tabletserver/SimpleLRUCacheTest.java
Modified:
    accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java

Modified: accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java?rev=1398359&r1=1398358&r2=1398359&view=diff
==============================================================================
--- accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
(original)
+++ accumulo/branches/1.4/src/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
Mon Oct 15 16:13:57 2012
@@ -194,6 +194,7 @@ import org.apache.accumulo.server.zookee
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.accumulo.start.Platform;
 import org.apache.accumulo.start.classloader.AccumuloClassLoader;
+import org.apache.commons.collections.map.LRUMap;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -2258,7 +2259,7 @@ public class TabletServer extends Abstra
       if (t == null) {
         // Tablet has probably been recently unloaded: repeated master
         // unload request is crossing the successful unloaded message
-        if (!recentlyUnloadedCache.contains(extent)) {
+        if (!recentlyUnloadedCache.containsKey(extent)) {
           log.info("told to unload tablet that was not being served " + extent);
           enqueueMasterMessage(new TabletStatusMessage(TabletLoadState.UNLOAD_FAILURE_NOT_SERVING,
extent));
         }
@@ -2281,7 +2282,7 @@ public class TabletServer extends Abstra
       
       // stop serving tablet - client will get not serving tablet
       // exceptions
-      recentlyUnloadedCache.add(extent);
+      recentlyUnloadedCache.put(extent, System.currentTimeMillis());
       onlineTablets.remove(extent);
       
       try {
@@ -2504,7 +2505,8 @@ public class TabletServer extends Abstra
   private SortedMap<KeyExtent,Tablet> onlineTablets = Collections.synchronizedSortedMap(new
TreeMap<KeyExtent,Tablet>());
   private SortedSet<KeyExtent> unopenedTablets = Collections.synchronizedSortedSet(new
TreeSet<KeyExtent>());
   private SortedSet<KeyExtent> openingTablets = Collections.synchronizedSortedSet(new
TreeSet<KeyExtent>());
-  private Set<KeyExtent> recentlyUnloadedCache = Collections.synchronizedSet(new SimpleLRUCache<KeyExtent>(10));
+  @SuppressWarnings("unchecked")
+  private Map<KeyExtent,Long> recentlyUnloadedCache = (Map<KeyExtent, Long>)Collections.synchronizedMap(new
LRUMap(1000));
   
   private Thread majorCompactorThread;
   



Mime
View raw message