[jbosscache-commits] JBoss Cache SVN: r4905 - in cache-bench-fwk/trunk: cache-products and 5 other directories.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Dec 20 23:53:46 EST 2007


Author: mircea.markus
Date: 2007-12-20 23:53:46 -0500 (Thu, 20 Dec 2007)
New Revision: 4905

Added:
   cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/
   cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/config.sh
   cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/src/
   cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/src/org/
   cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/src/org/cachebench/
   cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/src/org/cachebench/cachewrappers/
   cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/src/org/cachebench/cachewrappers/TerracottaWrapper.java
   cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/tc-client-config.xml
   cache-bench-fwk/trunk/runNode.sh
Log:
added the wrapper for terracotta 2.5.0

Added: cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/config.sh
===================================================================
--- cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/config.sh	                        (rev 0)
+++ cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/config.sh	2007-12-21 04:53:46 UTC (rev 4905)
@@ -0,0 +1,9 @@
+#!/bin/bash
+THIS_DIR=./cache-products/terracotta-2.5.0
+TC_HOME="/cygdrive/c/java/terracotta-2.5.0"
+CLASSPATH=$CLASSPATH:./classes/production/terracotta-2.5.0
+SYS_PROPS="$SYS_PROPS -Dtc.config=$THIS_DIR/tc-client-config.xml"
+export START_NODE_COMMAND="$TC_HOME/bin/dso-java.sh -cp $CLASSPATH $SYS_PROPS org.cachebench.CacheBenchmarkRunner"
+
+
+export START_NODE_COMMAND="java -Dtc.install-root=${TC_HOME} -Xbootclasspath/p:${TC_HOME}/lib/dso-boot/dso-boot-hotspot_win32_150_14.jar $SYS_PROPS -cp $CLASSPATH org.cachebench.CacheBenchmarkRunner"
\ No newline at end of file

Added: cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/src/org/cachebench/cachewrappers/TerracottaWrapper.java
===================================================================
--- cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/src/org/cachebench/cachewrappers/TerracottaWrapper.java	                        (rev 0)
+++ cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/src/org/cachebench/cachewrappers/TerracottaWrapper.java	2007-12-21 04:53:46 UTC (rev 4905)
@@ -0,0 +1,73 @@
+package org.cachebench.cachewrappers;
+
+import org.cachebench.CacheWrapper;
+
+import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * Cache wrapper for Terracotta 2.3.0
+ *
+ * Using the terracotta-cache package on http://www.terracotta.org/confluence/display/labs/Terracotta+Cache
+ *
+ * @author <a href="manik at jboss.org">Manik Surtani</a>
+ */
+public class TerracottaWrapper implements CacheWrapper
+{
+   // Since terracotta 
+   private Map cache = new HashMap();
+
+   public void init(Properties parameters) throws Exception
+   {
+   }
+
+   public void setUp() throws Exception
+   {
+   }
+
+   public void tearDown() throws Exception
+   {
+      synchronized(cache)
+      {
+         cache.clear();
+      }
+   }
+
+   public void put(Object key, Object value) throws Exception
+   {
+      synchronized(cache)
+      {
+         cache.put(key, value);
+      }
+   }
+
+   public Object get(Object key) throws Exception
+   {
+      synchronized(cache)
+      {
+         return cache.get(key);
+      }
+   }
+
+   public void empty() throws Exception
+   {
+      synchronized(cache)
+      {
+         cache.clear();
+      }
+   }
+
+   public int getNumMembers()
+   {
+      return -1;
+   }
+
+   public String getInfo()
+   {
+      synchronized(cache)
+      {
+         return "There are " + cache.size() + " objects in cache";
+      }
+   }
+}

Added: cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/tc-client-config.xml
===================================================================
--- cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/tc-client-config.xml	                        (rev 0)
+++ cache-bench-fwk/trunk/cache-products/terracotta-2.5.0/tc-client-config.xml	2007-12-21 04:53:46 UTC (rev 4905)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tc:tc-config xmlns:tc="http://www.terracotta.org/config">
+  <application>
+    <dso>
+      <roots>
+        <root>
+		  <field-name>org.cachebench.cachewrappers.TerracottaWrapper.cache</field-name>
+        </root>
+      </roots>
+      <locks>
+        <autolock>
+          <method-expression>* org.cachebench.cachewrappers.TerracottaWrapper*.*(..)</method-expression>
+          <lock-level>write</lock-level>
+        </autolock>
+      </locks>
+      <instrumented-classes>
+        <include><class-expression>org.cachebench.cachewrappers..*</class-expression></include>
+      </instrumented-classes>
+    </dso>
+  </application>
+</tc:tc-config>
+

Added: cache-bench-fwk/trunk/runNode.sh
===================================================================
--- cache-bench-fwk/trunk/runNode.sh	                        (rev 0)
+++ cache-bench-fwk/trunk/runNode.sh	2007-12-21 04:53:46 UTC (rev 4905)
@@ -0,0 +1,42 @@
+#!/bin/bash
+# author: Mircea.Markus at jboss.com
+# cygwin users: add the scripts from :pserver:anoncvs at cygwin.com:/cvs/cygwin-apps/wrappers/java to the cygwin_home/usr/local/bin
+# those would make an automatic conversion from unix CLASSPATH to win classpath, needed when executing java -cp 
+
+BIND_ADDRESS=127.0.0.1
+CACHE_DEBUG=true
+preferIPv4Stack=true
+
+export SYS_PROPS="-Dbind.address=$BIND_ADDRESS -DcurrentIndex=$1 -Dorg.cachebench.debug=$CACHE_DEBUG -Djava.net.preferIPv4Stack=$preferIPv4Stack"
+
+#libraries needed by the fwk, add them to the classpath
+for JAR in ./lib/*
+do
+   FWK_CLASS_PATH=$FWK_CLASS_PATH:$JAR
+done
+FWK_CLASS_PATH=$FWK_CLASS_PATH:./conf:./classes/production/Framework
+export FWK_CLASS_PATH
+
+CLASSPATH=$FWK_CLASS_PATH:$CLASSPATH
+
+configFile=./cache-products/$2/config.sh
+
+#first check whether the config file exists and load it
+if [ -f $configFile ]
+then
+  . $configFile
+else
+  echo could not find config file $configFile, exit!
+  exit 1
+fi
+
+if [ -n "$START_NODE_COMMAND" ]
+then
+   echo executing command $START_NODE_COMMAND
+   $START_NODE_COMMAND
+else   
+   TO_EXECUTE="java -cp $CLASSPATH $SYS_PROPS org.cachebench.CacheBenchmarkRunner $3"
+   echo executing $TO_EXECUTE
+   java -cp $CLASSPATH $SYS_PROPS org.cachebench.CacheBenchmarkRunner $3
+fi
+




More information about the jbosscache-commits mailing list