Author: manik.surtani(a)jboss.com
Date: 2008-07-31 12:22:52 -0400 (Thu, 31 Jul 2008)
New Revision: 6472
Modified:
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/lib/jbosscache-core.jar
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/src/org/cachebench/cachewrappers/JBossCache300Wrapper.java
Log:
Updated to latest snapshot of 3.0 - and allowed ability to use flat map
Modified:
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/lib/jbosscache-core.jar
===================================================================
(Binary files differ)
Modified:
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/src/org/cachebench/cachewrappers/JBossCache300Wrapper.java
===================================================================
---
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/src/org/cachebench/cachewrappers/JBossCache300Wrapper.java 2008-07-31
15:55:10 UTC (rev 6471)
+++
benchmarks/benchmark-fwk/trunk/cache-products/jbosscache-3.0.0/src/org/cachebench/cachewrappers/JBossCache300Wrapper.java 2008-07-31
16:22:52 UTC (rev 6472)
@@ -7,6 +7,7 @@
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Option;
+import org.jboss.cache.util.Caches;
import java.util.List;
import java.util.Map;
@@ -17,8 +18,15 @@
public class JBossCache300Wrapper implements CacheWrapper
{
private Cache cache;
+ private Map flatCache;
private Log log = LogFactory.getLog(JBossCache300Wrapper.class);
+ private final boolean FLAT; // this is final so that the compiler inlines it and it
doesn't become a reason for a perf bottleneck
+ public JBossCache300Wrapper()
+ {
+ FLAT = Boolean.getBoolean("cacheBenchFwk.useFlatCache");
+ }
+
public void init(Map parameters) throws Exception
{
log.info("Creating cache with the following configuration: " +
parameters);
@@ -26,6 +34,11 @@
log.info("Running cache with following config: " +
cache.getConfiguration());
log.info("Running following JBossCacheVersion: " +
org.jboss.cache.Version.version);
log.info("Running following JBossCacheCodeName: " +
org.jboss.cache.Version.codename);
+ if (FLAT)
+ {
+ log.info("Using FLAT MAP wrapper");
+ flatCache = Caches.asMap(cache);
+ }
}
public void setUp() throws Exception
@@ -39,18 +52,31 @@
public void put(List<String> path, Object key, Object value) throws Exception
{
- cache.put(Fqn.fromList((List) path, true), key, value);
+ if (FLAT)
+ flatCache.put(key, value);
+ else
+ cache.put(Fqn.fromList((List) path, true), key, value);
}
public Object get(List<String> path, Object key) throws Exception
{
- return cache.get(Fqn.fromList((List) path, true), key);
+ if (FLAT)
+ return flatCache.get(key);
+ else
+ return cache.get(Fqn.fromList((List) path, true), key);
}
public void empty() throws Exception
{
- //not removing root because there it fails with buddy replication:
http://jira.jboss.com/jira/browse/JBCACHE-1241
- cache.removeNode(Fqn.fromElements("test"));
+ if (FLAT)
+ {
+ flatCache.clear();
+ }
+ else
+ {
+ //not removing root because there it fails with buddy replication:
http://jira.jboss.com/jira/browse/JBCACHE-1241
+ cache.removeNode(Fqn.fromElements("test"));
+ }
}
public int getNumMembers()
@@ -72,6 +98,6 @@
}
Option option = cache.getInvocationContext().getOptionOverrides();
option.setForceDataGravitation(true);
- return cache.get(Fqn.fromList((List) path, true), key);
+ return get(path, key);
}
}