changeset 18:62b11f04d859

Make cache partitioning configurable.
author Dan Creswell <dan.creswell@gmail.com>
date Sun, 05 Jul 2009 16:51:24 +0100
parents 4580bb12db30
children 63b154c8521f
files src/org/dancres/blitz/entry/SleeveCache.java
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/dancres/blitz/entry/SleeveCache.java	Sun Jul 05 16:26:25 2009 +0100
+++ b/src/org/dancres/blitz/entry/SleeveCache.java	Sun Jul 05 16:51:24 2009 +0100
@@ -32,6 +32,7 @@
 import org.dancres.blitz.config.EntryConstraints;
 
 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicLong;
+import org.dancres.blitz.config.ConfigurationFactory;
 
 /**
    The organization of the space implementation can be viewed as being
@@ -54,7 +55,21 @@
     static Logger theLogger =
         Logging.newLogger("org.dancres.blitz.disk.SleeveCache");
 
-    private static final int DESIRED_ENTRIES_PER_PARTITION = 128;
+    private static int DESIRED_ENTRIES_PER_PARTITION = 0;
+
+    static {
+        try {
+            DESIRED_ENTRIES_PER_PARTITION =
+                    ((Integer) ConfigurationFactory.getEntry("cacheEntriesPerPartition", int.class,
+                    new Integer(128))).intValue();
+
+            theLogger.log(Level.SEVERE, "Loaded config: " + ((Integer) ConfigurationFactory.getEntry("cacheEntriesPerPartition", int.class,
+                    new Integer(128))).intValue());
+            
+        } catch (ConfigurationException aCE) {
+            theLogger.log(Level.SEVERE, "Failed to source partition setup", aCE);
+        }
+    }
 
     private final ArcCache[] theStoreCaches;
     private final int theNumPartitions;