MemoryMeter is no longer used by CacheService

Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/a5a3a28f
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a5a3a28f
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a5a3a28f

Branch: refs/heads/trunk
Commit: a5a3a28fc8cf69fa985b6c59fecb28578f12f4cf
Parents: ae0d6eb
Author: Jonathan Ellis <jbel...@apache.org>
Authored: Wed May 8 17:14:44 2013 -0500
Committer: Jonathan Ellis <jbel...@apache.org>
Committed: Wed May 8 17:14:44 2013 -0500

----------------------------------------------------------------------
 .../org/apache/cassandra/service/CacheService.java |   25 +-------------
 1 files changed, 2 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/a5a3a28f/src/java/org/apache/cassandra/service/CacheService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/CacheService.java 
b/src/java/org/apache/cassandra/service/CacheService.java
index 8396d61..5eff28a 100644
--- a/src/java/org/apache/cassandra/service/CacheService.java
+++ b/src/java/org/apache/cassandra/service/CacheService.java
@@ -33,8 +33,6 @@ import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
 import com.google.common.util.concurrent.Futures;
-import com.googlecode.concurrentlinkedhashmap.EntryWeigher;
-import org.github.jamm.MemoryMeter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -102,7 +100,6 @@ public class CacheService implements CacheServiceMBean
     }
 
     /**
-     * We can use Weighers.singleton() because Long can't be leaking memory
      * @return auto saving cache object
      */
     private AutoSavingCache<KeyCacheKey, RowIndexEntry> initKeyCache()
@@ -114,24 +111,7 @@ public class CacheService implements CacheServiceMBean
         // as values are constant size we can use singleton weigher
         // where 48 = 40 bytes (average size of the key) + 8 bytes (size of 
value)
         ICache<KeyCacheKey, RowIndexEntry> kc;
-        if (MemoryMeter.isInitialized())
-        {
-            kc = ConcurrentLinkedHashCache.create(keyCacheInMemoryCapacity);
-        }
-        else
-        {
-            logger.warn("MemoryMeter uninitialized (jamm not specified as java 
agent); KeyCache size in JVM Heap will not be calculated accurately. " +
-                        "Usually this means cassandra-env.sh disabled jamm 
because you are using a buggy JRE; upgrade to the Sun JRE instead");
-            /* We don't know the overhead size because memory meter is not 
enabled. */
-            EntryWeigher<KeyCacheKey, RowIndexEntry> weigher = new 
EntryWeigher<KeyCacheKey, RowIndexEntry>()
-            {
-                public int weightOf(KeyCacheKey key, RowIndexEntry entry)
-                {
-                    return key.key.length + entry.serializedSize();
-                }
-            };
-            kc = ConcurrentLinkedHashCache.create(keyCacheInMemoryCapacity, 
weigher);
-        }
+        kc = ConcurrentLinkedHashCache.create(keyCacheInMemoryCapacity);
         AutoSavingCache<KeyCacheKey, RowIndexEntry> keyCache = new 
AutoSavingCache<KeyCacheKey, RowIndexEntry>(kc, CacheType.KEY_CACHE, new 
KeyCacheSerializer());
 
         int keyCacheKeysToSave = DatabaseDescriptor.getKeyCacheKeysToSave();
@@ -272,8 +252,7 @@ public class CacheService implements CacheServiceMBean
         if (capacity < 0)
             throw new RuntimeException("capacity should not be negative.");
 
-        long weightedCapacity = capacity * 1024 * 1024;
-        keyCache.setCapacity(MemoryMeter.isInitialized() ? weightedCapacity : 
(weightedCapacity / 48));
+        keyCache.setCapacity(capacity * 1024 * 1024);
     }
 
     public long getRowCacheSize()

Reply via email to