Author: manik.surtani(a)jboss.com
Date: 2008-07-25 04:55:20 -0400 (Fri, 25 Jul 2008)
New Revision: 6405
Modified:
benchmarks/benchmark-fwk/trunk/cache-products/coherence-3.3.1/src/org/cachebench/cachewrappers/Coherence331Wrapper.java
Log:
Fixed stuff
Modified:
benchmarks/benchmark-fwk/trunk/cache-products/coherence-3.3.1/src/org/cachebench/cachewrappers/Coherence331Wrapper.java
===================================================================
---
benchmarks/benchmark-fwk/trunk/cache-products/coherence-3.3.1/src/org/cachebench/cachewrappers/Coherence331Wrapper.java 2008-07-25
08:50:32 UTC (rev 6404)
+++
benchmarks/benchmark-fwk/trunk/cache-products/coherence-3.3.1/src/org/cachebench/cachewrappers/Coherence331Wrapper.java 2008-07-25
08:55:20 UTC (rev 6405)
@@ -1,13 +1,12 @@
package org.cachebench.cachewrappers;
+import com.tangosol.net.CacheFactory;
+import com.tangosol.net.NamedCache;
import org.cachebench.CacheWrapper;
import java.util.List;
import java.util.Map;
-import com.tangosol.net.NamedCache;
-import com.tangosol.net.CacheFactory;
-
/**
* Pass in a -Dtangosol.coherence.localhost=IP_ADDRESS
*
@@ -18,13 +17,19 @@
{
private NamedCache cache;
-
- public void init(Map parameters) throws Exception {
+ boolean localmode;
+ Map parameters;
+
+ public void init(Map parameters) throws Exception
+ {
+ this.parameters = parameters;
}
- public void setUp() throws Exception {
+ public void setUp() throws Exception
+ {
String configuraton =
System.getProperty("cacheBenchFwk.cacheConfigFile");
String trimmedConfig = configuraton.trim();
+ localmode = (Boolean.parseBoolean((String)
parameters.get("localOnly")));
if (trimmedConfig.indexOf("repl") == 0)
{
cache = CacheFactory.getCache("repl-CacheBenchmarkFramework");
@@ -35,34 +40,57 @@
cache = CacheFactory.getCache("dist-CacheBenchmarkFramework");
return;
}
- throw new RuntimeException("Invalid configuration ('" + trimmedConfig
+ "'). Configuration name should start with: 'dist' or
'repl'");
+ if (trimmedConfig.indexOf("local") == 0)
+ {
+ cache = CacheFactory.getCache("local-CacheBenchmarkFramework");
+ return;
+ }
+ if (trimmedConfig.indexOf("opt") == 0)
+ {
+ cache = CacheFactory.getCache("opt-CacheBenchmarkFramework");
+ return;
+ }
+ if (trimmedConfig.indexOf("near") == 0)
+ {
+ cache = CacheFactory.getCache("near-CacheBenchmarkFramework");
+ return;
+ }
+
+ throw new RuntimeException("Invalid configuration ('" + trimmedConfig
+ "'). Configuration name should start with: 'dist', 'repl',
'local', 'opt' or 'near'");
}
- public void tearDown() throws Exception {
+ public void tearDown() throws Exception
+ {
if (cache != null) cache.release();
}
- public void put(List<String> path, Object key, Object value) throws Exception {
+ public void put(List<String> path, Object key, Object value) throws Exception
+ {
cache.put(pathAsString(path, key), value);
}
- public Object get(List<String> path, Object key) throws Exception {
- return cache.get( pathAsString(path, key));
+ public Object get(List<String> path, Object key) throws Exception
+ {
+ return cache.get(pathAsString(path, key));
}
- public void empty() throws Exception {
+ public void empty() throws Exception
+ {
cache.clear();
}
- public int getNumMembers() {
+ public int getNumMembers()
+ {
return cache.getCacheService().getCluster().getMemberSet().size();
}
- public String getInfo() {
- return null;
+ public String getInfo()
+ {
+ return null;
}
- public Object getReplicatedData(List<String> path, String key) throws Exception
{
+ public Object getReplicatedData(List<String> path, String key) throws Exception
+ {
return get(path, key);
}