[jboss-svn-commits] JBL Code SVN: r26568 - in labs/jbosstm/workspace/whitingjr/trunk/dstm2: bcel and 23 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri May 15 12:18:17 EDT 2009


Author: whitingjr
Date: 2009-05-15 12:18:16 -0400 (Fri, 15 May 2009)
New Revision: 26568

Added:
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/.classpath
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/.project
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/bcel/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/bcel/README
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/bcel/bcel-5.2.jar
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/bugs.xls
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/build.xml
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/docs/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/docs/readme.pdf
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/manifest.mf
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/build-impl.xml
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/genfiles.properties
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/private/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/private/config.properties
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/private/private.properties
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/private/private.xml
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/private/profiler/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/project.properties
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/project.xml
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/ContentionManager.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Defaults.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Main.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Thread.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Transaction.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/atomic.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/Benchmark.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/IntSetBenchmark.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/ListBenchmark.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/RBTreeBenchmark.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/SkipListBenchmark.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/ListBenchmark.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/LockFreeList.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/SkipListBenchmark.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/LockSet.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TSemaphore.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhase.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhaseMap.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhaseMapRW.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhaseRW.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/AbortedException.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/GracefulException.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/PanicException.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Adapter.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/AtomicFactory.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/BaseFactory.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ClassLoader.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Copyable.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/CopyableDef.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Factory.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Null/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Null/Adapter.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Property.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/SequentialFactory.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/TestFactory.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/boosting/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/boosting/Adapter.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/Adapter.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/CopyableFactory.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/Locator.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/ReadSet.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/XAdapter.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/recycle/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/recycle/Adapter.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/Adapter.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/ReadSet.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/Recoverable.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/RecoverableFactory.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/invisible/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/invisible/Adapter.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/invisible/LocalReadSet.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/twophase/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/twophase/Adapter.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/AggressiveManager.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/BackoffManager.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/BaseManager.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/EruptionManager.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/GreedyManager.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/KarmaManager.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/KindergartenManager.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/NullManager.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/PolkaManager.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/PriorityManager.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/AtomicArray.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/BoostedArray.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/BoostedInteger.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/BoostedSkipList.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/Random.java
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Benchmark.pl
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Documents/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Documents/dstm2.1-beta/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Documents/dstm2.1-beta/test/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Documents/dstm2.1-beta/test/080414.0908-dstm2.benchmark.SkipList-u0/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Documents/dstm2.1-beta/test/080414.0908-dstm2.benchmark.SkipList-u20/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Documents/dstm2.1-beta/test/080414.0908-dstm2.benchmark.SkipList-u50/
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/List.pl
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Ofree.pl
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/RBTree.pl
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Recycle.pl
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Recyle.pl
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/SkipList.pl
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Test.pl
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/bench.sh
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/benchmark-ListBenchmark-all-ofree-towhee-07-30-233204.raw
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/benchmark-ListBenchmark-all-shadow-towhee-07-30-234642.raw
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/benchmark-all-aggressive-ofree-oriole-07-21-125113.raw
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/config.pl
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/foo
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/recycle.xls
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/report.pl
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/report.txt
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/report2.pl
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/towhee.xls
   labs/jbosstm/workspace/whitingjr/trunk/dstm2/todo
Log:
added files from sun research project on stm.

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/.classpath
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/.classpath	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/.classpath	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry excluding="dstm2/factory/Null/" kind="src" path="src"/>
+	<classpathentry kind="src" path="src/dstm2/factory/Null"/>
+	<classpathentry kind="lib" path="bcel/bcel-5.2.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/.project
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/.project	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/.project	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>dstm2</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/bcel/README
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/bcel/README	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/bcel/README	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,6 @@
+Install the latest version of the Byte Code Engineering Library (BCEL)
+jar file here.  This file can be retrieved from
+
+  http://jakarta.apache.org/bcel/
+
+The DSTM2 code was tested using BCEL 5.2.

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/bcel/bcel-5.2.jar
===================================================================
(Binary files differ)


Property changes on: labs/jbosstm/workspace/whitingjr/trunk/dstm2/bcel/bcel-5.2.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/bugs.xls
===================================================================
(Binary files differ)


Property changes on: labs/jbosstm/workspace/whitingjr/trunk/dstm2/bugs.xls
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/build.xml
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/build.xml	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/build.xml	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<project name="dstm2.1" default="default" basedir=".">
+    <description>Builds, tests, and runs the project dstm2.1.</description>
+    <import file="nbproject/build-impl.xml"/>
+    <!--
+
+    There exist several targets which are by default empty and which can be 
+    used for execution of your tasks. These targets are usually executed 
+    before and after some main targets. They are: 
+
+      -pre-init:                 called before initialization of project properties
+      -post-init:                called after initialization of project properties
+      -pre-compile:              called before javac compilation
+      -post-compile:             called after javac compilation
+      -pre-compile-single:       called before javac compilation of single file
+      -post-compile-single:      called after javac compilation of single file
+      -pre-compile-test:         called before javac compilation of JUnit tests
+      -post-compile-test:        called after javac compilation of JUnit tests
+      -pre-compile-test-single:  called before javac compilation of single JUnit test
+      -post-compile-test-single: called after javac compilation of single JUunit test
+      -pre-jar:                  called before JAR building
+      -post-jar:                 called after JAR building
+      -post-clean:               called after cleaning build products
+
+    (Targets beginning with '-' are not intended to be called on their own.)
+
+    Example of inserting an obfuscator after compilation could look like this:
+
+        <target name="-post-compile">
+            <obfuscate>
+                <fileset dir="${build.classes.dir}"/>
+            </obfuscate>
+        </target>
+
+    For list of available properties check the imported 
+    nbproject/build-impl.xml file. 
+
+
+    Another way to customize the build is by overriding existing main targets.
+    The targets of interest are: 
+
+      -init-macrodef-javac:     defines macro for javac compilation
+      -init-macrodef-junit:     defines macro for junit execution
+      -init-macrodef-debug:     defines macro for class debugging
+      -init-macrodef-java:      defines macro for class execution
+      -do-jar-with-manifest:    JAR building (if you are using a manifest)
+      -do-jar-without-manifest: JAR building (if you are not using a manifest)
+      run:                      execution of project 
+      -javadoc-build:           Javadoc generation
+      test-report:              JUnit report generation
+
+    An example of overriding the target for project execution could look like this:
+
+        <target name="run" depends="dstm2.1-impl.jar">
+            <exec dir="bin" executable="launcher.exe">
+                <arg file="${dist.jar}"/>
+            </exec>
+        </target>
+
+    Notice that the overridden target depends on the jar target and not only on 
+    the compile target as the regular run target does. Again, for a list of available 
+    properties which you can use, check the target you are overriding in the
+    nbproject/build-impl.xml file. 
+
+    -->
+</project>

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/docs/readme.pdf
===================================================================
(Binary files differ)


Property changes on: labs/jbosstm/workspace/whitingjr/trunk/dstm2/docs/readme.pdf
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/manifest.mf
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/manifest.mf	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/manifest.mf	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/build-impl.xml
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/build-impl.xml	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/build-impl.xml	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,629 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT  ***
+***         EDIT ../build.xml INSTEAD         ***
+
+For the purpose of easier reading the script
+is divided into following sections:
+
+  - initialization
+  - compilation
+  - jar
+  - execution
+  - debugging
+  - javadoc
+  - junit compilation
+  - junit execution
+  - junit debugging
+  - applet
+  - cleanup
+
+        -->
+<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="dstm2.1-impl">
+    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
+    <!-- 
+                ======================
+                INITIALIZATION SECTION 
+                ======================
+            -->
+    <target name="-pre-init">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="-pre-init" name="-init-private">
+        <property file="nbproject/private/config.properties"/>
+        <property file="nbproject/private/configs/${config}.properties"/>
+        <property file="nbproject/private/private.properties"/>
+    </target>
+    <target depends="-pre-init,-init-private" name="-init-user">
+        <property file="${user.properties.file}"/>
+        <!-- The two properties below are usually overridden -->
+        <!-- by the active platform. Just a fallback. -->
+        <property name="default.javac.source" value="1.4"/>
+        <property name="default.javac.target" value="1.4"/>
+    </target>
+    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
+        <property file="nbproject/configs/${config}.properties"/>
+        <property file="nbproject/project.properties"/>
+    </target>
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
+        <available file="${manifest.file}" property="manifest.available"/>
+        <condition property="manifest.available+main.class">
+            <and>
+                <isset property="manifest.available"/>
+                <isset property="main.class"/>
+                <not>
+                    <equals arg1="${main.class}" arg2="" trim="true"/>
+                </not>
+            </and>
+        </condition>
+        <condition property="manifest.available+main.class+mkdist.available">
+            <and>
+                <istrue value="${manifest.available+main.class}"/>
+                <isset property="libs.CopyLibs.classpath"/>
+            </and>
+        </condition>
+        <condition property="have.tests">
+            <or>
+                <available file="${test.test.dir}"/>
+            </or>
+        </condition>
+        <condition property="have.sources">
+            <or>
+                <available file="${src.src.dir}"/>
+            </or>
+        </condition>
+        <condition property="netbeans.home+have.tests">
+            <and>
+                <isset property="netbeans.home"/>
+                <isset property="have.tests"/>
+            </and>
+        </condition>
+        <condition property="no.javadoc.preview">
+            <and>
+                <isset property="javadoc.preview"/>
+                <isfalse value="${javadoc.preview}"/>
+            </and>
+        </condition>
+        <property name="run.jvmargs" value=""/>
+        <property name="javac.compilerargs" value=""/>
+        <property name="work.dir" value="${basedir}"/>
+        <condition property="no.deps">
+            <and>
+                <istrue value="${no.dependencies}"/>
+            </and>
+        </condition>
+        <property name="javac.debug" value="true"/>
+        <property name="javadoc.preview" value="true"/>
+        <property name="application.args" value=""/>
+        <property name="source.encoding" value="${file.encoding}"/>
+        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
+            <and>
+                <isset property="javadoc.encoding"/>
+                <not>
+                    <equals arg1="${javadoc.encoding}" arg2=""/>
+                </not>
+            </and>
+        </condition>
+        <property name="javadoc.encoding.used" value="${source.encoding}"/>
+        <property name="includes" value="**"/>
+        <property name="excludes" value=""/>
+        <property name="do.depend" value="false"/>
+        <condition property="do.depend.true">
+            <istrue value="${do.depend}"/>
+        </condition>
+        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
+            <and>
+                <isset property="jaxws.endorsed.dir"/>
+                <available file="nbproject/jaxws-build.xml"/>
+            </and>
+        </condition>
+    </target>
+    <target name="-post-init">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
+        <fail unless="src.src.dir">Must set src.src.dir</fail>
+        <fail unless="test.test.dir">Must set test.test.dir</fail>
+        <fail unless="build.dir">Must set build.dir</fail>
+        <fail unless="dist.dir">Must set dist.dir</fail>
+        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
+        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
+        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
+        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
+        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
+        <fail unless="dist.jar">Must set dist.jar</fail>
+    </target>
+    <target name="-init-macrodef-property">
+        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute name="name"/>
+            <attribute name="value"/>
+            <sequential>
+                <property name="@{name}" value="${@{value}}"/>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-javac">
+        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${src.src.dir}" name="srcdir"/>
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <attribute default="${javac.classpath}" name="classpath"/>
+            <attribute default="${includes}" name="includes"/>
+            <attribute default="${excludes}" name="excludes"/>
+            <attribute default="${javac.debug}" name="debug"/>
+            <attribute default="" name="sourcepath"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/>
+                    <customize/>
+                </javac>
+            </sequential>
+        </macrodef>
+        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${src.src.dir}" name="srcdir"/>
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <attribute default="${javac.classpath}" name="classpath"/>
+            <sequential>
+                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                </depend>
+            </sequential>
+        </macrodef>
+        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${build.classes.dir}" name="destdir"/>
+            <sequential>
+                <fail unless="javac.includes">Must set javac.includes</fail>
+                <pathconvert pathsep="," property="javac.includes.binary">
+                    <path>
+                        <filelist dir="@{destdir}" files="${javac.includes}"/>
+                    </path>
+                    <globmapper from="*.java" to="*.class"/>
+                </pathconvert>
+                <delete>
+                    <files includes="${javac.includes.binary}"/>
+                </delete>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-junit">
+        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${includes}" name="includes"/>
+            <attribute default="${excludes}" name="excludes"/>
+            <attribute default="**" name="testincludes"/>
+            <sequential>
+                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
+                    <batchtest todir="${build.test.results.dir}">
+                        <fileset dir="${test.test.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
+                            <filename name="@{testincludes}"/>
+                        </fileset>
+                    </batchtest>
+                    <classpath>
+                        <path path="${run.test.classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="test-sys-prop."/>
+                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <formatter type="brief" usefile="false"/>
+                    <formatter type="xml"/>
+                    <jvmarg line="${run.jvmargs}"/>
+                </junit>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-nbjpda">
+        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute default="${main.class}" name="name"/>
+            <attribute default="${debug.classpath}" name="classpath"/>
+            <attribute default="" name="stopclassname"/>
+            <sequential>
+                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="dt_socket">
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                </nbjpdastart>
+            </sequential>
+        </macrodef>
+        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute default="${build.classes.dir}" name="dir"/>
+            <sequential>
+                <nbjpdareload>
+                    <fileset dir="@{dir}" includes="${fix.classes}">
+                        <include name="${fix.includes}*.class"/>
+                    </fileset>
+                </nbjpdareload>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-debug-args">
+        <property name="version-output" value="java version &quot;${ant.java.version}"/>
+        <condition property="have-jdk-older-than-1.4">
+            <or>
+                <contains string="${version-output}" substring="java version &quot;1.0"/>
+                <contains string="${version-output}" substring="java version &quot;1.1"/>
+                <contains string="${version-output}" substring="java version &quot;1.2"/>
+                <contains string="${version-output}" substring="java version &quot;1.3"/>
+            </or>
+        </condition>
+        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
+            <istrue value="${have-jdk-older-than-1.4}"/>
+        </condition>
+    </target>
+    <target depends="-init-debug-args" name="-init-macrodef-debug">
+        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+            <attribute default="${main.class}" name="classname"/>
+            <attribute default="${debug.classpath}" name="classpath"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <java classname="@{classname}" dir="${work.dir}" fork="true">
+                    <jvmarg line="${debug-args-line}"/>
+                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
+                    <jvmarg line="${run.jvmargs}"/>
+                    <classpath>
+                        <path path="@{classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="run-sys-prop."/>
+                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <customize/>
+                </java>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-macrodef-java">
+        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <attribute default="${main.class}" name="classname"/>
+            <element name="customize" optional="true"/>
+            <sequential>
+                <java classname="@{classname}" dir="${work.dir}" fork="true">
+                    <jvmarg line="${run.jvmargs}"/>
+                    <classpath>
+                        <path path="${run.classpath}"/>
+                    </classpath>
+                    <syspropertyset>
+                        <propertyref prefix="run-sys-prop."/>
+                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
+                    </syspropertyset>
+                    <customize/>
+                </java>
+            </sequential>
+        </macrodef>
+    </target>
+    <target name="-init-presetdef-jar">
+        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
+            <jar compress="${jar.compress}" jarfile="${dist.jar}">
+                <j2seproject1:fileset dir="${build.classes.dir}"/>
+            </jar>
+        </presetdef>
+    </target>
+    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar" name="init"/>
+    <!--
+                ===================
+                COMPILATION SECTION
+                ===================
+            -->
+    <target depends="init" name="deps-jar" unless="no.deps"/>
+    <target depends="init,deps-jar" name="-pre-pre-compile">
+        <mkdir dir="${build.classes.dir}"/>
+    </target>
+    <target name="-pre-compile">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target if="do.depend.true" name="-compile-depend">
+        <j2seproject3:depend/>
+    </target>
+    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile">
+        <j2seproject3:javac/>
+        <copy todir="${build.classes.dir}">
+            <fileset dir="${src.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+        </copy>
+    </target>
+    <target name="-post-compile">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
+    <target name="-pre-compile-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
+        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
+        <j2seproject3:force-recompile/>
+        <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.src.dir}"/>
+    </target>
+    <target name="-post-compile-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
+    <!--
+                ====================
+                JAR BUILDING SECTION
+                ====================
+            -->
+    <target depends="init" name="-pre-pre-jar">
+        <dirname file="${dist.jar}" property="dist.jar.dir"/>
+        <mkdir dir="${dist.jar.dir}"/>
+    </target>
+    <target name="-pre-jar">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available">
+        <j2seproject1:jar/>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
+        <j2seproject1:jar manifest="${manifest.file}"/>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
+        <j2seproject1:jar manifest="${manifest.file}">
+            <j2seproject1:manifest>
+                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
+            </j2seproject1:manifest>
+        </j2seproject1:jar>
+        <echo>To run this application from the command line without Ant, try:</echo>
+        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
+        <property location="${dist.jar}" name="dist.jar.resolved"/>
+        <pathconvert property="run.classpath.with.dist.jar">
+            <path path="${run.classpath}"/>
+            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
+        </pathconvert>
+        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
+    </target>
+    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries">
+        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
+        <pathconvert property="run.classpath.without.build.classes.dir">
+            <path path="${run.classpath}"/>
+            <map from="${build.classes.dir.resolved}" to=""/>
+        </pathconvert>
+        <pathconvert pathsep=" " property="jar.classpath">
+            <path path="${run.classpath.without.build.classes.dir}"/>
+            <chainedmapper>
+                <flattenmapper/>
+                <globmapper from="*" to="lib/*"/>
+            </chainedmapper>
+        </pathconvert>
+        <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
+        <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
+            <fileset dir="${build.classes.dir}"/>
+            <manifest>
+                <attribute name="Main-Class" value="${main.class}"/>
+                <attribute name="Class-Path" value="${jar.classpath}"/>
+            </manifest>
+        </copylibs>
+        <echo>To run this application from the command line without Ant, try:</echo>
+        <property location="${dist.jar}" name="dist.jar.resolved"/>
+        <echo>java -jar "${dist.jar.resolved}"</echo>
+    </target>
+    <target name="-post-jar">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
+    <!--
+                =================
+                EXECUTION SECTION
+                =================
+            -->
+    <target depends="init,compile" description="Run a main class." name="run">
+        <j2seproject1:java>
+            <customize>
+                <arg line="${application.args}"/>
+            </customize>
+        </j2seproject1:java>
+    </target>
+    <target name="-do-not-recompile">
+        <property name="javac.includes.binary" value=""/>
+    </target>
+    <target depends="init,-do-not-recompile,compile-single" name="run-single">
+        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+        <j2seproject1:java classname="${run.class}"/>
+    </target>
+    <!--
+                =================
+                DEBUGGING SECTION
+                =================
+            -->
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
+        <j2seproject1:nbjpdastart name="${debug.class}"/>
+    </target>
+    <target depends="init,compile" name="-debug-start-debuggee">
+        <j2seproject3:debug>
+            <customize>
+                <arg line="${application.args}"/>
+            </customize>
+        </j2seproject3:debug>
+    </target>
+    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
+    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
+        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
+    </target>
+    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
+    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
+        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
+        <j2seproject3:debug classname="${debug.class}"/>
+    </target>
+    <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
+    <target depends="init" name="-pre-debug-fix">
+        <fail unless="fix.includes">Must set fix.includes</fail>
+        <property name="javac.includes" value="${fix.includes}.java"/>
+    </target>
+    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
+        <j2seproject1:nbjpdareload/>
+    </target>
+    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
+    <!--
+                ===============
+                JAVADOC SECTION
+                ===============
+            -->
+    <target depends="init" name="-javadoc-build">
+        <mkdir dir="${dist.javadoc.dir}"/>
+        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
+            <classpath>
+                <path path="${javac.classpath}"/>
+            </classpath>
+            <fileset dir="${src.src.dir}" excludes="${excludes}" includes="${includes}">
+                <filename name="**/*.java"/>
+            </fileset>
+        </javadoc>
+    </target>
+    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
+        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
+    </target>
+    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
+    <!--
+                =========================
+                JUNIT COMPILATION SECTION
+                =========================
+            -->
+    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
+        <mkdir dir="${build.test.classes.dir}"/>
+    </target>
+    <target name="-pre-compile-test">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target if="do.depend.true" name="-compile-test-depend">
+        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.test.dir}"/>
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
+        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.test.dir}"/>
+        <copy todir="${build.test.classes.dir}">
+            <fileset dir="${test.test.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+        </copy>
+    </target>
+    <target name="-post-compile-test">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
+    <target name="-pre-compile-test-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
+        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
+        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
+        <j2seproject3:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" sourcepath="${test.test.dir}" srcdir="${test.test.dir}"/>
+        <copy todir="${build.test.classes.dir}">
+            <fileset dir="${test.test.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+        </copy>
+    </target>
+    <target name="-post-compile-test-single">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
+    <!--
+                =======================
+                JUNIT EXECUTION SECTION
+                =======================
+            -->
+    <target depends="init" if="have.tests" name="-pre-test-run">
+        <mkdir dir="${build.test.results.dir}"/>
+    </target>
+    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
+        <j2seproject3:junit testincludes="**/*Test.java"/>
+    </target>
+    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
+        <fail if="tests.failed">Some tests failed; see details above.</fail>
+    </target>
+    <target depends="init" if="have.tests" name="test-report"/>
+    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
+    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
+    <target depends="init" if="have.tests" name="-pre-test-run-single">
+        <mkdir dir="${build.test.results.dir}"/>
+    </target>
+    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
+        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
+        <j2seproject3:junit excludes="" includes="${test.includes}"/>
+    </target>
+    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
+        <fail if="tests.failed">Some tests failed; see details above.</fail>
+    </target>
+    <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
+    <!--
+                =======================
+                JUNIT DEBUGGING SECTION
+                =======================
+            -->
+    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
+        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
+        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
+        <delete file="${test.report.file}"/>
+        <mkdir dir="${build.test.results.dir}"/>
+        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
+            <customize>
+                <syspropertyset>
+                    <propertyref prefix="test-sys-prop."/>
+                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
+                </syspropertyset>
+                <arg value="${test.class}"/>
+                <arg value="showoutput=true"/>
+                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
+                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
+            </customize>
+        </j2seproject3:debug>
+    </target>
+    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
+        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
+    </target>
+    <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
+    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
+        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
+    </target>
+    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
+    <!--
+                =========================
+                APPLET EXECUTION SECTION
+                =========================
+            -->
+    <target depends="init,compile-single" name="run-applet">
+        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+        <j2seproject1:java classname="sun.applet.AppletViewer">
+            <customize>
+                <arg value="${applet.url}"/>
+            </customize>
+        </j2seproject1:java>
+    </target>
+    <!--
+                =========================
+                APPLET DEBUGGING  SECTION
+                =========================
+            -->
+    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
+        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+        <j2seproject3:debug classname="sun.applet.AppletViewer">
+            <customize>
+                <arg value="${applet.url}"/>
+            </customize>
+        </j2seproject3:debug>
+    </target>
+    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
+    <!--
+                ===============
+                CLEANUP SECTION
+                ===============
+            -->
+    <target depends="init" name="deps-clean" unless="no.deps"/>
+    <target depends="init" name="-do-clean">
+        <delete dir="${build.dir}"/>
+        <delete dir="${dist.dir}"/>
+    </target>
+    <target name="-post-clean">
+        <!-- Empty placeholder for easier customization. -->
+        <!-- You can override this target in the ../build.xml file. -->
+    </target>
+    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
+</project>

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/genfiles.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/genfiles.properties	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/genfiles.properties	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=14f20c6a
+build.xml.script.CRC32=bc394ee2
+build.xml.stylesheet.CRC32=be360661
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=14f20c6a
+nbproject/build-impl.xml.script.CRC32=ad660c95
+nbproject/build-impl.xml.stylesheet.CRC32=487672f9

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/private/config.properties
===================================================================

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/private/private.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/private/private.properties	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/private/private.properties	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,10 @@
+application.args=-t 32 -n 30000 -e 100 -m dstm2.manager.PriorityManager -a dstm2.factory.recycle.Adapter -b dstm2.benchmark.RBTreeBenchmark 
+do.depend=false
+do.jar=true
+file.reference.bcel-5.2.jar=C:\\Documents and Settings\\mph\\My Documents\\dstm2.1-beta\\bcel\\bcel-5.2.jar
+file.reference.dstm2.1-release-src=C:\\Documents and Settings\\mph\\My Documents\\dstm2.1-beta\\src
+file.reference.dstm2.1-release-test=C:\\Documents and Settings\\mph\\My Documents\\dstm2.1-beta\\test
+javac.debug=true
+javadoc.preview=true
+jaxws.endorsed.dir=C:\\Program Files\\NetBeans 6.1\\java2\\modules\\ext\\jaxws21\\api
+user.properties.file=C:\\Documents and Settings\\mph\\.netbeans\\6.1\\build.properties

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/private/private.xml
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/private/private.xml	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/private/private.xml	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+    <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+    <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
+        <file>file:/C:/Documents%20and%20Settings/mph/My%20Documents/dstm2.1-beta/src/dstm2/factory/rls/Adapter.java</file>
+    </open-files>
+</project-private>

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/project.properties
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/project.properties	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/project.properties	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,59 @@
+application.args=
+application.title=dstm2.1
+application.vendor=mh109922
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+debug.classpath=\
+    ${run.classpath}
+debug.test.classpath=\
+    ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/dstm2.1.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+excludes=
+file.reference.bcel-5.2.jar=bcel/bcel-5.2.jar
+includes=**
+jar.compress=false
+javac.classpath=\
+    ${file.reference.bcel-5.2.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.source=1.6
+javac.target=1.6
+javac.test.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}:\
+    ${libs.junit.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+main.class=dstm2.Main
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+platform.active=default_platform
+run.classpath=\
+    ${javac.classpath}:\
+    ${build.classes.dir}
+run.jvmargs=-ea
+run.test.classpath=\
+    ${javac.test.classpath}:\
+    ${build.test.classes.dir}
+src.src.dir=src
+test.test.dir=test

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/project.xml
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/project.xml	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/nbproject/project.xml	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.java.j2seproject</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
+            <name>dstm2.1</name>
+            <minimum-ant-version>1.6.5</minimum-ant-version>
+            <source-roots>
+                <root id="src.src.dir"/>
+            </source-roots>
+            <test-roots>
+                <root id="test.test.dir"/>
+            </test-roots>
+        </data>
+    </configuration>
+</project>

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/ContentionManager.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/ContentionManager.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/ContentionManager.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,55 @@
+/*
+ * ContentionManager.java
+ *
+ * Created on July 8, 2008
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2;
+
+import java.util.Collection;
+/**
+ * Interface satisfied by all contention managers
+ */
+public interface ContentionManager {
+  /**
+   * Either give the writer a chance to finish it, abort it, or both.
+   * @param me Calling transaction.
+   * @param other Transaction that's in my way.
+   */
+  void resolveConflict(Transaction me, Transaction other);
+  
+  /**
+   * Either give the writer a chance to finish it, abort it, or both.
+   * @param me Calling transaction.
+   * @param other set of transactions in my way
+   */
+  void resolveConflict(Transaction me, Collection<Transaction> other);
+  
+  /**
+   * Assign a priority to caller. Not all managers assign meaningful priorities.
+   * @return Priority of conflicting transaction.
+   */
+  long getPriority();
+  
+  /**
+   * Change this manager's priority.
+   * @param value new priority value
+   */
+  void setPriority(long value);
+  
+  /**
+   * Notify manager that object was opened.
+   */
+  void openSucceeded();
+  
+  /**
+   * Notify manager that transaction committed.
+   */
+  void committed();
+  
+};

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Defaults.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Defaults.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Defaults.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,43 @@
+/*
+ * Defaults.java *
+ * Created on July 8, 2008
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2;
+
+/**
+ * 
+ * @author Maurice Herlihy
+ */
+public class Defaults {
+  /**
+   * how many threads
+   **/
+  public static final int THREADS = 1;
+  /**
+   * benchmark duration in milliseconds
+   **/
+  public static final int TIME = 10000;
+  /**
+   * uninterpreted arg passed to benchmark
+   **/
+  public static final int EXPERIMENT = 100;
+  /**
+   * fully-qualified contention manager name
+   **/
+  public static final String MANAGER = "dstm2.manager.BackoffManager";
+  /**
+   * fully-qualified factory name
+   **/
+  public static final String FACTORY = "dstm2.factory.shadow.Factory";
+  /**
+   * fully-qualified adapter name
+   **/
+  public static final String ADAPTER = "dstm2.factory.shadow.Adapter";
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Main.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Main.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Main.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,156 @@
+/*
+ * Main.java *
+ * Created on July 8, 2008
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2;
+import static dstm2.Defaults.*;
+import dstm2.benchmark.Benchmark;
+
+public class Main {
+  
+  /**
+   * @param args the command line arguments
+   * usage: dstm.benchmark.Main  -b <benchmarkclass> [-m <managerclass>] [-t <#threads>] [-n <#time-in-ms>] [-e <experiment#>] [-f <factory>"
+   */
+  public static void main(String args[]) {
+    int numThreads = THREADS;
+    int numMillis  = TIME;
+    int experiment = EXPERIMENT;
+    String managerClassName = MANAGER;
+    Class managerClass = null;
+    String benchmarkClassName = null;
+    Class benchmarkClass = null;
+    
+    String adapterClassName = Defaults.ADAPTER;
+    
+    // discard statistics from previous runs
+    Thread.clear();
+    // Parse and check the args
+    int argc = 0;
+    try {
+      do {
+        String option = args[argc++];
+        if (option.equals("-m"))
+          managerClassName = args[argc];
+        else if (option.equals("-b"))
+          benchmarkClassName = args[argc];
+        else if (option.equals("-t"))
+          numThreads = Integer.parseInt(args[argc]);
+        else if (option.equals("-n"))
+          numMillis = Integer.parseInt(args[argc]);
+        else if (option.equals("-e"))
+          experiment = Integer.parseInt(args[argc]);
+        else if (option.equals("-a"))
+          adapterClassName = args[argc];
+        else
+          reportUsageErrorAndDie("Unrecognized option:" + option);
+        argc++;
+      } while (argc < args.length);
+    } catch (NumberFormatException e) {
+      System.out.println("Expected a number: " + args[argc]);
+      System.exit(0);
+    } catch (Exception e) {
+      reportUsageErrorAndDie("Unhandled exception: " + e);
+    }
+    
+    // Initialize contention manager.
+    try {
+      managerClass = Class.forName(managerClassName);
+      Thread.setContentionManagerClass(managerClass);
+    } catch (ClassNotFoundException ex) {
+      reportUsageErrorAndDie("Contention manager class not found "
+          + managerClassName);
+    }
+    
+    // Initialize adapter class
+    Thread.setAdapterClass(adapterClassName);
+    
+    // initialize benchmark
+    Benchmark benchmark = null;
+    try {
+      benchmarkClass = Class.forName(benchmarkClassName);
+      benchmark = (Benchmark) benchmarkClass.newInstance();
+    } catch (InstantiationException e) {
+      System.out.format("%s does not implement dstm.benchmark.Benchmark: %s\n", benchmarkClass, e);
+      System.exit(0);
+    } catch (ClassCastException e) {
+      System.out.format("Exception when creating class %s: %s\n", benchmarkClass, e);
+      System.exit(0);
+    } catch (Exception e) {
+      e.printStackTrace(System.out);
+      System.exit(0);
+    }
+    
+    // Set up the benchmark
+    long startTime = 0;
+    
+    Thread[] thread = new Thread[numThreads];
+    System.out.println("Duration: " + numMillis);
+    System.out.println("Benchmark: " + benchmarkClass);
+    System.out.println("Adapter: " + adapterClassName);
+    System.out.println("Contention manager: " + managerClassName);
+    System.out.println("Threads: " + numThreads);
+    System.out.println("Mix: " + experiment + "% updates");
+    
+    try {
+      for (int i = 0; i < numThreads; i++)
+        thread[i] = benchmark.createThread(experiment);
+      startTime = System.currentTimeMillis();
+      for (int i = 0; i < numThreads; i++)
+        thread[i].start();
+      Thread.sleep(numMillis);
+      Thread.stop = true;     // notify threads to stop
+      for (int i = 0; i < numThreads; i++) {
+        thread[i].join();
+      }
+      for (int i = 0; i < numThreads; i++) {
+        thread[i].collectStatistics();
+      }
+    } catch (Exception e) {
+      e.printStackTrace(System.out);
+      System.exit(0);
+    }
+    long stopTime = System.currentTimeMillis();
+    
+    double elapsed = (double)(stopTime - startTime) / 1000.0;
+    
+    // Run the sanity check for this benchmark
+    try {
+      benchmark.sanityCheck();
+    } catch (Exception e) {
+      e.printStackTrace(System.out);
+    }
+    
+    long committed = Thread.totalCommitted;
+    long total = Thread.totalTotal;
+    if (total > 0) {
+      System.out.printf("Committed: %d\nTotal: %d\nPercent committed: (%d%%)\n",
+          committed,
+          total,
+          (100 * committed) / total);
+    } else {
+      System.out.println("No transactions executed!");
+    }
+    benchmark.report();
+    System.out.println("Elapsed time: " + elapsed + " seconds.");
+    System.out.println("----------------------------------------");
+  }
+  
+  private static void reportUsageErrorAndDie(String string) {
+    System.out.println("Unknown option: " + string);
+    reportUsageErrorAndDie();
+  }
+  private static void reportUsageErrorAndDie() {
+    System.out.println("usage: dstm2.Main -b <benchmarkclass> [-m <managerclass>] [-t <#threads>] [-n <#time-in-ms>] [-e <experiment#>] [-a <adapter>]");
+    System.exit(0);
+  }
+  
+}
+

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Thread.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Thread.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Thread.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,566 @@
+/*
+ * Thread.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2;
+
+import dstm2.exceptions.AbortedException;
+import dstm2.exceptions.GracefulException;
+import dstm2.exceptions.PanicException;
+import dstm2.factory.AtomicFactory;
+import dstm2.factory.Factory;
+import java.util.ArrayDeque;
+import java.util.Collections;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import static dstm2.Defaults.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
+/**
+ * The basic unit of computation for the transactional memory.  This
+ * class extends <code>java.lang.Thread</code> by providing methods to
+ * begin, commit and abort transactions.
+ *
+ * Every <code>Thread</code> has a contention manager, created when
+ * the thread is created.  Before creating any <code>Thread</code>s,
+ * you must call <code>Thread.setContentionManager</code> to set the
+ * class of the contention manager that will be created.  The
+ * contention manager of a thread is notified (by invoking its
+ * notification methods) of the results of any methods involving the
+ * thread.  It is also consulted on whether a transaction should be
+ * begun.
+ *
+ * @see dstm2.ContentionManager
+ */
+public class Thread extends java.lang.Thread {
+
+  /**
+   * Contention manager class.
+   */
+  protected static Class contentionManagerClass;
+  /**
+   * Adapter class.
+   */
+  protected static Class<dstm2.factory.Adapter> adapterClass;
+  /**
+   * Set to true when benchmark runs out of time.
+   **/
+  public static volatile boolean stop = false;
+  /**
+   * number of threads in start-up argument
+   **/
+  private static int numThreadsArg;  //static Deque<Runnable> onBeginOnce = new ArrayDeque<Runnable>();
+  static Deque<Runnable> onBegin = new ArrayDeque<Runnable>();
+  static Deque<Runnable> onAbort = new ArrayDeque<Runnable>();
+  static Deque<Runnable> onCommit = new ArrayDeque<Runnable>();
+  static Deque<Runnable> onFinish = new ArrayDeque<Runnable>();  // statistics
+  public static long totalCommitted;
+  public static long totalTotal;
+  public static long totalTotalMemRefs;
+  public static long totalMemRefs;
+  public static long totalCommittedMemRefs;
+  static ThreadLocal<ThreadState> localThreadState = new ThreadLocal<ThreadState>() {
+
+    @Override
+    protected synchronized ThreadState initialValue() {
+      return new ThreadState();
+    }
+  };
+  static ThreadLocal<Thread> _thread = new ThreadLocal<Thread>() {
+
+    @Override
+    protected synchronized Thread initialValue() {
+      return null;
+    }
+  };
+  private static int MAX_NESTING_DEPTH = 1;
+  private static AtomicInteger sequence = new AtomicInteger();
+  // Memo-ize factories so we don't have to recreate them.
+  private static Map<Class, Factory> factoryTable = Collections.synchronizedMap(new HashMap<Class, Factory>());
+  static Deque<Callable<Boolean>> onValidate = new ArrayDeque<Callable<Boolean>>();
+  ThreadState threadState;
+
+  /**
+   * Create thread to run a method.
+   * @param target execute this object's <CODE>run()</CODE> method
+   */
+  public Thread(final Runnable target) {
+    super(new Runnable() {
+
+      @Override
+      public void run() {
+        ThreadState threadState = localThreadState.get();
+        threadState.reset();
+        target.run();
+      }
+    });
+  }
+
+  /**
+   * no-arg constructor
+   */
+  public Thread() {
+    super();
+  }
+
+  @Override
+  public void run() {
+    threadState = localThreadState.get();
+    super.run();
+  }
+
+  public static int getIndex() {
+    return localThreadState.get().index;
+  }
+
+  /**
+   * Establishes a contention manager.  You must call this method
+   * before creating any <code>Thread</code>.
+   *
+   * @see dstm2.ContentionManager
+   * @param theClass class of desired contention manager.
+   */
+  public static void setContentionManagerClass(Class theClass) {
+    try {
+      contentionManagerClass = theClass;
+    } catch (Exception e) {
+      throw new PanicException("The class " + theClass + " does not implement dstm2.ContentionManager");
+    }
+  }
+
+  /**
+   * set Adapter class for this thread
+   * @param adapterClassName adapter class as string
+   */
+  @SuppressWarnings("unchecked")
+  public static void setAdapterClass(String adapterClassName) {
+    try {
+      adapterClass = (Class<dstm2.factory.Adapter>) Class.forName(adapterClassName);
+    } catch (ClassNotFoundException ex) {
+      throw new PanicException("Adapter class not found: %s\n", adapterClassName);
+    }
+  }
+
+  /**
+   * Gets the current transaction, if any, of the invoking <code>Thread</code>.
+   *
+   * @return the current thread's current transaction; <code>null</code> if
+   *         there is no current transaction.
+   */
+  static public Transaction getTransaction() {
+    return localThreadState.get().transaction;
+  }
+
+  /**
+   * Gets the contention manager of the invoking <code>Thread</code>.
+   *
+   * @return the invoking thread's contention manager
+   */
+  static public ContentionManager getContentionManager() {
+    return localThreadState.get().manager;
+  }
+
+  /**
+   * Create a new factory instance.
+   * @param <T> Type of object created
+   * @param _class class to implement
+   * @return new factory
+   */
+  static public <T> Factory<T> makeFactory(Class<T> _class) {
+    try {
+      @SuppressWarnings("unchecked")
+      Factory<T> factory = (Factory<T>) factoryTable.get(_class);
+      if (factory == null) {
+        factory = new AtomicFactory<T>(_class, adapterClass);
+        factoryTable.put(_class, factory);
+      }
+      return factory;
+    } catch (Exception e) {
+      throw new PanicException(e);
+    }
+  }
+
+  /**
+   * Execute a transaction
+   * @param <T> Type of object returned
+   * @param xaction execute this object's <CODE>call()</CODE> method.
+   * @return result of <CODE>call()</CODE> method
+   */
+  public <T> T doIt(Callable<T> xaction) {
+    T result = null;
+    try {
+      while (!Thread.stop) {
+        boolean normal = false;
+        threadState.beginTransaction();
+        try {
+          result = xaction.call();
+          normal = true;
+        } catch (AbortedException d) {
+          threadState.abortTransaction();
+        } catch (GracefulException g) {
+          throw g;
+        } catch (InterruptedException x) {
+          Thread.currentThread().interrupt();
+          threadState.abortTransaction();
+          throw new GracefulException();
+        } catch (Exception e) {
+          e.printStackTrace();
+          throw new PanicException("Unhandled exception " + e);
+        } finally {
+          threadState.depth--;
+        }
+        threadState.totalMemRefs += threadState.transaction.memRefs;
+        if (normal && threadState.commitTransaction()) {
+          threadState.committedMemRefs += threadState.transaction.memRefs;
+          return result;
+        }
+      // transaction aborted
+      }
+    } finally {
+      threadState.transaction = null;
+    }
+    throw new GracefulException();
+  }
+
+  /**
+   * Execute transaction
+   * @param xaction call this object's <CODE>run()</CODE> method
+   */
+  public void doIt(final Runnable xaction) {
+    doIt(new Callable<Boolean>() {
+
+      @Override
+      public Boolean call() {
+        xaction.run();
+        return false;
+      }
+    });
+  }
+
+  /**
+   * number of transactions committed by this thread
+   * @return number of transactions committed by this thread
+   */
+  public static long getCommitted() {
+    return totalCommitted;
+  }
+
+  /**
+   * umber of transactions aborted by this thread
+   * @return number of aborted transactions
+   */
+  public static long getAborted() {
+    return totalTotal - totalCommitted;
+  }
+
+  /**
+   * number of transactions executed by this thread
+   * @return number of transactions
+   */
+  public static long getTotal() {
+    return totalTotal;
+  }
+
+  /**
+   * Register a method to be called every time any thread starts a transaction.
+   * @param r call this object's <CODE>run()</CODE> method
+   */
+  public static void onBegin(Runnable r) {
+    onBegin.offerLast(r);
+  }
+
+  /**
+   * Register a method to be called every time a transaction commits.
+   * @param r call this object's <CODE>run()</CODE> method
+   */
+  public static void onCommit(Runnable r) {
+    onCommit.offerLast(r);
+  }
+
+  /**
+   * Register a method to be called every time a transaction aborts.
+   * @param r call this object's <CODE>run()</CODE> method
+   */
+  public static void onAbort(Runnable r) {
+    onAbort.offerLast(r);
+  }
+
+  /**
+   * Register a method to be called every time any thread commits or aborts
+   * a transaction. Method is called after every other registered commit or
+   * abort method.
+   * @param r call this object's <CODE>run()</CODE> method
+   */
+  public static void onFinish(Runnable r) {
+    onFinish.offerLast(r);
+  }
+
+  /**
+   * Register a method to be called when the current transaction starts.
+   * Method is discarded the first time current transaction commits.
+   * @param r call this object's <CODE>run()</CODE> method
+   */
+  public static void onBeginOnce(Runnable r) {
+    localThreadState.get().onBeginOnce.offerLast(r);
+  }
+
+  /**
+   * Register a method to be called when the current transaction aborts.
+   * Method is discarded the first time current transaction commits.
+   * @param r call this object's <CODE>run()</CODE> method
+   */
+  public static void onAbortOnce(Runnable r) {
+    localThreadState.get().onAbortOnce.offerLast(r);
+  }
+
+  /**
+   * Register a method to be called when the current transaction commits.
+   * Method is discarded the first time current transaction commits.
+   * @param r call this object's <CODE>run()</CODE> method
+   */
+  public static void onCommitOnce(Runnable r) {
+    localThreadState.get().onCommitOnce.offerLast(r);
+  }
+
+  /**
+   * Register a method to be called when the current transaction commits
+   * or aborts.
+   * Method is discarded the first time current transaction commits.
+   * @param r call this object's <CODE>run()</CODE> method
+   */
+  public static void onFinishOnce(Runnable r) {
+    localThreadState.get().onFinishOnce.offerLast(r);
+  }
+
+  /**
+   * get thread ID for debugging
+   * @return unique id
+   */
+  public static int getID() {
+    return localThreadState.get().hashCode();
+  }
+
+  /**
+   * reset thread statistics
+   */
+  public static void clear() {
+    totalTotal = 0;
+    totalCommitted = 0;
+    totalCommittedMemRefs = 0;
+    totalTotalMemRefs = 0;
+    stop = false;
+  }
+
+  void collectStatistics() {
+    totalTotalMemRefs = threadState.totalMemRefs;
+    totalCommittedMemRefs = threadState.committedMemRefs;
+    totalCommitted += threadState.committed;
+    totalTotal += threadState.total;
+    threadState.reset();  // set up for next iteration
+  }
+
+  /**
+   * Class that holds thread's actual state
+   */
+  public static class ThreadState {
+
+    int depth = 0;
+    ContentionManager manager;
+    private long committed = 0;        // number of committed transactions
+    private long total = 0;            // total number of transactions
+    private long committedMemRefs = 0; // number of committed reads and writes
+    private long totalMemRefs = 0;     // total number of reads and writes
+    private int index = 0;
+    Deque<Runnable> onBeginOnce = new ArrayDeque<Runnable>();
+    Deque<Runnable> onCommitOnce = new ArrayDeque<Runnable>();
+    Deque<Runnable> onAbortOnce = new ArrayDeque<Runnable>();
+    Deque<Runnable> onFinishOnce = new ArrayDeque<Runnable>();
+    Transaction transaction = null;
+
+    /**
+     * Creates new ThreadState
+     */
+    public ThreadState() {
+      try {
+        index = sequence.getAndIncrement();
+        manager = (ContentionManager) Thread.contentionManagerClass.newInstance();
+      } catch (NullPointerException e) {
+        throw new PanicException("No default contention manager class set.");
+      } catch (Exception e) {  // Some problem with instantiation
+
+        throw new PanicException(e);
+      }
+    }
+
+    /**
+     * Resets any metering information (commits/aborts, etc).
+     */
+    public void reset() {
+      committed = 0;        // number of committed transactions
+
+      total = 0;            // total number of transactions
+
+      committedMemRefs = 0; // number of committed reads and writes
+
+      totalMemRefs = 0;     // total number of reads and writes
+
+    }
+
+    /**
+     * used for debugging
+     * @return string representation of thread state
+     */
+    @Override
+    public String toString() {
+      return "Thread" + hashCode() + "[" +
+          "committed: " + committed + "," +
+          "aborted: " + (total - committed) +
+          "]";
+    }
+
+    /**
+     * Can this transaction still commit?
+     * This method may be called at any time, not just at transaction end,
+     * so we do not clear the onValidateOnce table.
+     * @return true iff transaction might still commit
+     */
+    public boolean validate() {
+      try {
+        return transaction.validate();
+      } catch (Exception ex) {
+        return false;
+      }
+    }
+
+    /**
+     * Starts a new transaction.  Cannot nest transactions deeper than
+     * <code>Thread.MAX_NESTING_DEPTH.</code> The contention manager of the
+     * invoking thread is notified when a transaction is begun.
+     */
+    public void beginTransaction() {
+      // new transaction or retry of failed transaction?
+      if (transaction == null) {
+        transaction = new Transaction();
+      } else {
+        transaction = new Transaction(transaction);
+      }
+      if (depth == 0) {
+        total++;
+        Iterator<Runnable> it = onBeginOnce.descendingIterator();
+        while (it.hasNext()) {
+          it.next().run();
+        }
+        it = onBegin.descendingIterator();
+        while (it.hasNext()) {
+          it.next().run();
+        }
+      }
+      // first thing to fix if we allow nested transactions
+      if (depth >= MAX_NESTING_DEPTH) {
+        throw new PanicException("beginTransaction: attempting to nest transactions too deeply.");
+      }
+      depth++;
+    }
+
+    /**
+     * Attempts to commit the current transaction of the invoking
+     * <code>Thread</code>.  Always succeeds for nested
+     * transactions.  The contention manager of the invoking thread is
+     * notified of the result.  If the transaction does not commit
+     * because a <code>TMObject</code> opened for reading was
+     * invalidated, the contention manager is also notified of the
+     * inonValidate.
+     *
+     *
+     * @return whether commit succeeded.
+     */
+    public boolean commitTransaction() {
+      if (depth < 0) {
+        throw new PanicException("commitTransaction invoked when no transaction active.");
+      } else if (depth > 0) {
+        throw new PanicException("commitTransaction invoked on nested transaction.");
+      } else if (depth == 0) {  // showtime!
+        if (validate() && transaction.commit()) {
+          committed++;
+          Iterator<Runnable> it;
+          it = onCommitOnce.descendingIterator();
+          while (it.hasNext()) {
+            it.next().run();
+          }
+          it = onCommit.descendingIterator();
+          while (it.hasNext()) {
+            it.next().run();
+          }
+          it = onFinish.descendingIterator();
+          while (it.hasNext()) {
+            it.next().run();
+          }
+          // clear out temporaryily registered methods
+          onBeginOnce.clear();
+          onCommitOnce.clear();
+          onAbortOnce.clear();
+          onFinishOnce.clear();
+          return true;
+        }
+        abortTransaction();
+        return false;
+      } else {
+        return true;
+      }
+    }
+
+    public void abortTransaction() {
+      transaction.abort();
+      Iterator<Runnable> it;
+      it = onAbortOnce.descendingIterator();
+      while (it.hasNext()) {
+        it.next().run();
+      }
+      onAbortOnce.clear();
+      it = onAbort.descendingIterator();
+      while (it.hasNext()) {
+        it.next().run();
+      }
+      it = onFinish.descendingIterator();
+      while (it.hasNext()) {
+        it.next().run();
+      }
+    }
+  }
+
+  public static int getNumThreadsArg() {
+    return numThreadsArg;
+  }
+
+  public static void setNumThreadsArg(int value) {
+    numThreadsArg = value;
+  }
+
+  class Stats {
+
+    /**
+     * number of committed transactions for all threads
+     */
+    volatile long totalCommitted = 0;
+    /**
+     * total number of transactions for all threads
+     */
+    volatile long totalTotal = 0;
+    /**
+     * number of committed memory references for all threads
+     */
+    volatile long totalCommittedMemRefs = 0;
+    /**
+     * total number of memory references for all threads
+     */
+    volatile long totalTotalMemRefs = 0;
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Transaction.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Transaction.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/Transaction.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,270 @@
+/*
+ * Transaction.java *
+ * Created on July 8, 2008
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2;
+
+import dstm2.exceptions.GracefulException;
+import dstm2.exceptions.PanicException;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
+
+/**
+ * Transaction.java
+ * Keeps a transaction's status and contention manager.
+ */
+public class Transaction implements java.lang.Comparable {
+
+  /**
+   * Possible transaction status
+   **/
+  public enum Status {
+
+    ABORTED, ACTIVE, COMMITTED
+  };
+  /**
+   * Predefined committed transaction
+   */
+  public final static Transaction COMMITTED;
+  /**
+   * Predefined orted transaction
+   */
+  public final static Transaction ABORTED;
+  /**
+   * Is transaction waiting for another?
+   */
+  public volatile boolean waiting = false;
+  /**
+   * Number of times this transaction tried
+   */
+  public volatile int attempts = 0;
+  /**
+   * Number of unique memory references so far.
+   */
+  public int memRefs = 0;
+  /**
+   * Time in nanos when transaction started
+   */
+  public long startTime = 0;
+  /**
+   * Time in nanos when transaction committed or aborted
+   */
+  public long stopTime = 0;
+  // generate unique ids
+  final int id;
+  private static AtomicInteger unique;
+  /** Updater for status */
+  private static final AtomicReferenceFieldUpdater<Transaction, Status> statusUpdater =
+      AtomicReferenceFieldUpdater.newUpdater(Transaction.class, Status.class, "status");
+  private volatile Status status;
+  private ContentionManager manager;
+  
+
+  static {
+    unique = new AtomicInteger(100);
+    ABORTED = new Transaction(Status.ABORTED);
+    COMMITTED = new Transaction(Status.COMMITTED);
+  }
+
+  /**
+   * Creates a new, active transaction.
+   */
+  public Transaction() {
+    status = Status.ACTIVE;
+    manager = Thread.getContentionManager();
+    startTime = System.currentTimeMillis();
+    id = unique.getAndIncrement();
+    attempts = 0;
+  }
+
+  /**
+   * Creates a new transaction with given status.
+   * @param myStatus active, committed, or aborted
+   */
+  private Transaction(Transaction.Status myStatus) {
+    status = myStatus;
+    startTime = 0;
+    id = unique.getAndIncrement();
+    manager = Thread.getContentionManager();
+  }
+  /**
+   * Creates a transaction to retry failed transaction
+   * @param prior transaction to retry
+   */
+  public Transaction(Transaction prior) {
+    status = Status.ACTIVE;   
+    id = prior.id;
+    attempts = prior.attempts + 1;
+    startTime = prior.startTime;
+    manager = prior.manager;
+  }
+
+  /**
+   * Access the transaction's current status.
+   * @return current transaction status
+   */
+  public Status getStatus() {
+    return status;
+  }
+
+  /**
+   * Tests whether transaction is active.
+   * @return whether transaction is active
+   */
+  public boolean isActive() {
+    return this.getStatus() == Status.ACTIVE;
+  }
+
+  /**
+   * Tests whether transaction is aborted.
+   * @return whether transaction is aborted
+   */
+  public boolean isAborted() {
+    return this.getStatus() == Status.ABORTED;
+  }
+
+  /**
+   * Tests whether transaction is committed.
+   * @return whether transaction is committed
+   */
+  public boolean isCommitted() {
+    return (this.getStatus() == Status.COMMITTED);
+  }
+
+  /**
+   * Tests whether transaction is committed or active.
+   * @return whether transaction is committed or active
+   */
+  public boolean validate() {
+    Status myStatus = this.getStatus();
+    switch (myStatus) {
+      case COMMITTED:
+        throw new PanicException("committed transaction still running");
+      case ACTIVE:
+        return true;
+      case ABORTED:
+        return false;
+      default:
+        throw new PanicException("unexpected transaction state: " + myStatus);
+    }
+  }
+
+  /**
+   * Tries to commit transaction
+   * @return whether transaction was committed
+   */
+  public boolean commit() {
+    try {
+      while (this.getStatus() == Status.ACTIVE) {
+        if (statusUpdater.compareAndSet(this,
+            Status.ACTIVE,
+            Status.COMMITTED)) {
+          return true;
+        }
+      }
+      return false;
+    } finally {
+      wakeUp();
+    }
+  }
+
+  /**
+   * Tries to abort transaction
+   * @return whether transaction was aborted (not necessarily by this call)
+   */
+  public boolean abort() {
+    try {
+      while (this.getStatus() == Status.ACTIVE) {
+        if (statusUpdater.compareAndSet(this, Status.ACTIVE, Status.ABORTED)) {
+          return true;
+        }
+      }
+      return this.getStatus() == Status.ABORTED;
+    } finally {
+      wakeUp();
+    }
+  }
+
+  /**
+   * Returns a string representation of this transaction
+   * @return the string representcodes[ation
+   */
+  @Override
+  public String toString() {
+    switch (this.status) {
+      case COMMITTED:
+        return "Tr:" + id + "." + attempts + "[committed]";
+      case ABORTED:
+        return "Tr:" + id + "." + attempts + "[aborted]";
+      case ACTIVE:
+        return "Tr:" + id + "." + attempts + "[active]";
+      default:
+        return "Tr:" + id + "." + attempts + "[???]";
+    }
+  }
+
+  /**
+   * Block caller while transaction is active.
+   */
+  public synchronized void waitWhileActive() {
+    try {
+      while (this.getStatus() == Status.ACTIVE) {
+        wait();
+      }
+    } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
+      throw new GracefulException();
+    }
+
+  }
+
+  /**
+   * Block caller while transaction is active.
+   * 
+   */
+  public synchronized void waitWhileActiveNotWaiting() {
+    while (getStatus() == Status.ACTIVE && !waiting) {
+      try {
+        wait(1000);
+      } catch (InterruptedException ex) {
+        Thread.currentThread().interrupt();
+        throw new GracefulException();
+      }
+    }
+  }
+
+  /**
+   * Wake up any transactions waiting for this one to finish.
+   */
+  public synchronized void wakeUp() {
+    notifyAll();
+  }
+
+  /**
+   * This transaction's contention manager
+   * @return the manager
+   */
+  public ContentionManager getContentionManager() {
+    return manager;
+  }
+
+  @Override
+  public int compareTo(Object o) {
+    Transaction other = (Transaction) o;
+    int myHashCode = this.hashCode();
+    int yrHashCode = other.hashCode();
+    if (myHashCode < yrHashCode) {
+      return -1;
+    } else if (myHashCode > yrHashCode) {
+      return 1;
+    } else {
+      return 0;
+    }
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/atomic.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/atomic.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/atomic.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,26 @@
+/*
+ * atomic.java *
+ * Created on July 8, 2008
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation indicating that class is atomic (can be shared among transactions).
+ * @author Maurice Herlihy
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target(ElementType.TYPE)
+public @interface atomic {
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/Benchmark.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/Benchmark.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/Benchmark.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,41 @@
+/*
+ * ListBenchmark.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.benchmark;
+import dstm2.Thread;
+
+/**
+ * A simple interface for uniform benchmarks for DSTMx
+ **/
+public interface Benchmark 
+{
+  /**
+     * Creates a thread to run the benchmark.
+     * 
+     * @param which <code>int</code> which test to run
+     * @return Thread the thread to run the benchmark
+     */
+  public Thread createThread(int which);
+
+  /**
+   * Checks that after running the benchmark, the resulting data
+   * structure meets a specified "sanity check".  Prints messages to
+   * <code>System.out</code> if problems are found, or confirmation
+   * that no problems were found.
+   * @param stats how big should the object be?
+   */
+  public void sanityCheck();
+
+  /**
+   * Reports statistics.
+   */
+  public void report();
+}
+

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/IntSetBenchmark.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/IntSetBenchmark.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/IntSetBenchmark.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,291 @@
+/*
+ * ListBenchmark.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.benchmark;
+
+import dstm2.exceptions.GracefulException;
+import dstm2.Thread;
+import dstm2.util.Random;
+import java.util.Iterator;
+import java.util.concurrent.Callable;
+
+/**
+ * This abstract class is the superclass for the integer set benchmarks.
+ * @author Maurice Herlihy
+ * @date April 2004
+ */
+public abstract class IntSetBenchmark implements Benchmark, Iterable<Integer> {
+
+  /**
+   * How large to initialize the integer set.
+   */
+  protected final int INITIAL_SIZE = 8;
+  /**
+   * Range of values added and removed by a single transaction
+   */
+  protected final int TRANSACTION_RANGE = 128;
+  /**
+   * After the run is over, synchronize merging statistics with other threads.
+   */
+  private static final Object lock = new Object();
+  /**
+   * Long benchmarks wait for this many milliseconds
+   */
+  protected static final int TRANSACTION_DELAY = 100;
+  /**
+   * local variable
+   */
+  int element;
+  /**
+   * local variable
+   */
+  int value;
+  /**
+   * Number of calls to insert()
+   */
+  int insertCalls = 0;
+  /**
+   * number of calls to contains()
+   */
+  int containsCalls = 0;
+  /**
+   * number of calls to remove()
+   */
+  int removeCalls = 0;
+  /**
+   * amount by which the set size has changed
+   */
+  int delta = 0;
+
+  /**
+   * Give subclass a chance to intialize private fields.
+   */
+  protected abstract void init();
+
+  /**
+   * Give subclass a chance to intialize thread-local fields.
+   */
+  protected void threadLocalInit() {
+  }
+
+  /**
+   * Iterate through set. Not necessarily thread-safe.
+   */
+  @Override
+  public abstract Iterator<Integer> iterator();
+
+  /**
+   * Add an element to the integer set, if it is not already there.
+   * @param v the integer value to add from the set
+   * @return true iff value was added.
+   *
+   */
+  public abstract boolean add(int v);
+
+  /**
+   * Tests wheter a value is in an the integer set.
+   * @param v the integer value to insert into the set
+   * @return true iff presence was confirmed.
+   *
+   */
+  public abstract boolean contains(int v);
+
+  /**
+   * Removes an element from the integer set, if it is there.
+   * @param v the integer value to delete from the set
+   * @return true iff v was removed
+   *
+   */
+  public abstract boolean remove(int v);
+
+  /**
+   * Creates a new test thread.
+   * @param percent Mix of mutators and observers.
+   * @return Thread to run.
+   */
+  @Override
+  public Thread createThread(int percent) {
+    try {
+      TestThread testThread = new TestThread(this, percent);
+      return testThread;
+    } catch (Exception e) {
+      e.printStackTrace(System.out);
+      return null;
+    }
+  }
+
+  /**
+   * Prints an error message to <code>System.out</code>, including a
+   *  standard header to identify the message as an error message.
+   * @param s String describing error
+   */
+  protected static void reportError(String s) {
+    System.out.println(" ERROR: " + s);
+    System.out.flush();
+  }
+
+  @Override
+  public void report() {
+    System.out.println("Insert/Remove calls:\t" + (insertCalls + removeCalls));
+    System.out.println("Contains calls:\t" + containsCalls);
+  }
+
+  private class TestThread extends Thread {
+
+    IntSetBenchmark intSet;
+    /**
+     * Thread-local statistic.
+     */
+    int myInsertCalls = 0;
+    /**
+     * Thread-local statistic.
+     */
+    int myRemoveCalls = 0;
+    /**
+     * Thread-local statistic.
+     */
+    int myContainsCalls = 0;
+    /**
+     * Thread-local statistic.
+     */
+    int myDelta = 0; // net change
+    public int percent = 0; // percent inserts
+
+    TestThread(IntSetBenchmark intSet, int percent) {
+      this.intSet = intSet;
+      this.percent = percent;
+    }
+
+    @Override
+    public void run() {
+      super.run();
+      intSet.threadLocalInit();
+      Random random = new Random(this.hashCode());
+//      random.setSeed(System.currentTimeMillis()); // comment out for determinstic
+      int id = Thread.getID();
+      boolean toggle = true;
+      dstm2.Thread thread = (dstm2.Thread) Thread.currentThread();
+      try {
+        while (true) {
+          boolean result = true;
+          element = random.nextInt();
+          value = (id * TRANSACTION_RANGE) + Math.abs(element % TRANSACTION_RANGE);
+          if (Math.abs(element) % 100 < percent) {
+            if (toggle) {
+              // insert on even turns
+              result = thread.doIt(new Callable<Boolean>() {
+
+                @Override
+                public Boolean call() {
+                  return intSet.add(value);
+                }
+              });
+              if (result) {
+                myDelta++;
+              }
+              myInsertCalls++;
+            } else {
+              // remove on odd turns
+              result = thread.doIt(new Callable<Boolean>() {
+
+                @Override
+                public Boolean call() {
+                  return intSet.remove(value);
+                }
+              });
+              myRemoveCalls++;
+              if (result) {
+                this.myDelta--;
+              }
+            }
+            toggle = !toggle;
+          } else {
+            thread.doIt(new Callable<Void>() {
+
+              @Override
+              public Void call() throws InterruptedException {
+                intSet.contains(value);
+                return null;
+              }
+            });
+            myContainsCalls++;
+          }
+        }
+      } catch (GracefulException g) {
+        // update statistics
+        synchronized (lock) {
+          insertCalls += myInsertCalls;
+          removeCalls += myRemoveCalls;
+          containsCalls += myContainsCalls;
+          delta += myDelta;
+        }
+        return;
+      }
+    }
+  }
+
+  @Override
+  public void sanityCheck() {
+    long expected = INITIAL_SIZE + delta;
+    int length = 0;
+
+    int prevValue = Integer.MIN_VALUE;
+    boolean ok = true;
+    for (int myValue : this) {
+      length++;
+      if (myValue < prevValue) {
+        ok = false;
+        System.out.printf("ERROR: set  not sorted: %d, %d\n", prevValue, myValue);
+      }
+      if (myValue == prevValue) {
+        ok = false;
+        System.out.printf("ERROR: set has duplicate: %d\n", myValue);
+      }
+      prevValue = myValue;
+    }
+    if (length != expected) {
+      ok = false;
+      System.out.printf("ERROR: set has bad length, found %d, expected %d\n", length, expected);
+    }
+    if (ok) {
+      System.out.println("Integer Set OK");
+    }
+  }
+
+  /**
+   * Creates a new IntSetBenchmark
+   */
+  public IntSetBenchmark() {
+    int size = 0;
+    init();
+    Random random = new Random(this.hashCode());
+    while (size < INITIAL_SIZE) {
+      if (add(random.nextInt())) {
+        size++;
+      }
+    }
+  }
+
+  /**
+   * sleep if running transactionally
+   *
+   */
+  protected static void delay() {
+    try {
+      if (dstm2.Thread.getTransaction() == null) {
+        return;
+      }
+      dstm2.Thread.sleep(TRANSACTION_DELAY);
+    } catch (InterruptedException ex) {
+            Thread.currentThread().interrupt();
+      throw new GracefulException();
+    }
+  }
+}
\ No newline at end of file

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/ListBenchmark.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/ListBenchmark.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/ListBenchmark.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,174 @@
+/*
+ * ListBenchmark.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.benchmark;
+
+import dstm2.Main;
+import dstm2.atomic;
+import dstm2.factory.Factory;
+import dstm2.Thread;
+import java.util.Iterator;
+
+/**
+ * @author Maurice Herlihy
+ */
+public class ListBenchmark extends IntSetBenchmark {
+
+  static Factory<INode> factory;
+  protected INode first;
+
+  @Override
+  protected void init() {
+    factory = Thread.makeFactory(INode.class);
+    INode firstList = factory.create();
+    firstList.setValue(Integer.MIN_VALUE);
+    this.first = firstList;
+    INode firstNext = factory.create();
+    firstNext.setValue(Integer.MAX_VALUE);
+    firstList.setNext(firstNext);
+  }
+
+  /**
+   * Returns a <code>dstm.benchmark.IntSetBenchmark.Neighborhood</code> object
+   * containing references to the node less than v, equal to v,
+   * and greater than v, or <code>null</code> if they do not exist.
+   * @param v value sought
+   * @return neighborhood of value
+   */
+  protected Neighborhood find(int v) {
+    INode prevNode = this.first;
+    assert prevNode != null;
+    INode currNode = prevNode.getNext();
+    assert currNode != null;
+    while (currNode.getValue() < v) {
+      prevNode = currNode;
+      currNode = prevNode.getNext();
+    }
+    if (currNode.getValue() == v) {
+      return new Neighborhood(prevNode, currNode);
+    } else {
+      return new Neighborhood(prevNode);
+    }
+  }
+
+  /**
+   * Add an element to the integer set, if it is not already there.
+   * @param v the integer value to add from the set
+   * @return true iff value was added.
+   */
+  @Override
+  public boolean add(int v) {
+    Neighborhood hood = find(v);
+    if (hood.currNode != null) {
+      return false;
+    } else {
+      INode newNode = factory.create();
+      newNode.setValue(v);
+      INode prevNode = hood.prevNode;
+      newNode.setNext(prevNode.getNext());
+      prevNode.setNext(newNode);
+      return true;
+    }
+  }
+
+  /**
+   * Tests wheter a value is in an the integer set.
+   * @param v the integer value to insert into the set
+   * @return true iff presence was confirmed.
+   */
+  @Override
+  public boolean contains(int v) {
+    Neighborhood hood = find(v);
+    return hood.currNode != null;
+  }
+
+  /**
+   * Removes an element from the integer set, if it is there.
+   * @param v the integer value to delete from the set
+   * @return true iff v was removed
+   */
+  @Override
+  public boolean remove(int v) {
+    Neighborhood hood = find(v);
+    if (hood.currNode == null) {
+      return false;
+    } else {
+      INode prevNode = hood.prevNode;
+      prevNode.setNext(hood.currNode.getNext());
+      return true;
+    }
+  }
+
+  @atomic
+  public interface INode {
+
+    int getValue();
+
+    void setValue(int value);
+
+    INode getNext();
+
+    void setNext(INode value);
+  }
+
+  @Override
+  public Iterator<Integer> iterator() {
+    return new Iterator<Integer>() {
+
+      INode cursor = ListBenchmark.this.first.getNext();
+
+      @Override
+      public boolean hasNext() {
+        assert cursor != null;
+        Integer value = cursor.getValue();
+        assert value != null;
+        return cursor.getValue() != Integer.MAX_VALUE;
+      }
+
+      @Override
+      public Integer next() {
+        INode node = cursor;
+        cursor = cursor.getNext();
+        return node.getValue();
+      }
+
+      @Override
+      public void remove() {
+        throw new UnsupportedOperationException();
+      }
+    };
+  }
+
+  protected static class Neighborhood {
+
+    public INode prevNode;
+    public INode currNode;
+
+    public Neighborhood(INode prevNode, INode currNode) {
+      this.prevNode = prevNode;
+      this.currNode = currNode;
+    }
+
+    public Neighborhood(INode prevNode) {
+      this.prevNode = prevNode;
+    }
+  }
+
+  public static void main(String[] a) {
+    String[] myArgs = {
+      "-m", "dstm2.manager.PriorityManager",
+      "-a", "dstm2.factory.ofree.Adapter",
+      "-b", "dstm2.benchmark.ListBenchmark",
+      "-t", "32",
+      "-n", "10000",
+      "-e", "100"
+    };
+    Main.main(myArgs);
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/RBTreeBenchmark.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/RBTreeBenchmark.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/RBTreeBenchmark.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,636 @@
+/*
+ * RBTreeBenchmark.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.benchmark;
+
+import dstm2.Main;
+import dstm2.atomic;
+import dstm2.factory.Factory;
+import dstm2.Thread;
+import java.util.Iterator;
+import java.util.Stack;
+
+/**
+ * Red-Black tree benchmark.
+ * Adapted from {@link http://www.codeproject.com/csharp/RedBlackCS.asp
+ * }
+ * @author Maurice Herlihy
+ */
+public class RBTreeBenchmark extends IntSetBenchmark {
+  /**
+   * Transactional RBNode factory. Do not make this field static.
+   */
+  static Factory<RBNode> factory;
+  /**
+   * Each node has one of two colors.
+   */
+  public enum Color {BLACK, RED};
+  
+  /**
+   * Left hand of darkness: the actual root of the tree is the left-hand
+   * child of this node. Indirection needed to make changes to the root
+   * transactional.
+   */
+  private RBNode root;
+  /**
+   * Used in place of null pointer.
+   */
+  public static RBNode sentinelNode;
+  static {
+    factory = Thread.makeFactory(RBNode.class);   
+    sentinelNode = factory.create();
+    sentinelNode.setValue(123456);
+    sentinelNode.setLeft(null);
+    sentinelNode.setRight(null);
+    sentinelNode.setParent(null);
+    sentinelNode.setColor(Color.BLACK); 
+  }
+  /**
+   * Initializes the tree shared by all the threads.
+   **/
+  @Override
+  public void init() {
+    root = factory.create();
+    root.setLeft(sentinelNode);
+    this.root.setValue(Integer.MIN_VALUE);
+    this.root.setColor(Color.BLACK);
+  }
+  
+  protected RBNode getRoot() {
+    return root.getLeft();
+  }
+  
+  protected void setRoot(RBNode value) {
+    root.setLeft(value);
+  }
+  
+  /**
+   * Inserts an element into the tree, if it is not already present.
+   * @param key element to insert
+   * @return true iff item was not there already
+   */
+  @Override
+  public boolean add(int key) {
+    // traverse tree - find where node belongs
+    RBNode node	= factory.create();
+    RBNode temp	= getRoot();
+    
+    while(temp != sentinelNode) {	// find Parent
+      node.setParent(temp);
+      if ( key == temp.getValue()) {
+        return false;
+      } else if (key > temp.getValue()) {
+        temp = temp.getRight();
+      } else {
+        temp = temp.getLeft();
+      }
+    }
+    
+    // setup node
+    node.setValue(key);
+    node.setLeft(sentinelNode);
+    node.setRight(sentinelNode);
+    
+    // insert node into tree starting at parent's location
+    if(node.getParent() != null) {
+      if (node.getValue() > node.getParent().getValue()) {
+        node.getParent().setRight(node);
+      } else
+        node.getParent().setLeft(node);
+    } else
+      setRoot(node); 		// first node added
+    
+    restoreAfterInsert(node);           // restore red-black properities
+    return true;
+  }
+  
+  /**
+   * Tests whether item is present.
+   * @return whether the item was present</returns>
+   * @param key item to search for
+   */
+  @Override
+  public boolean contains(int key) {
+    
+    RBNode node = getRoot();     // begin at root
+    
+    // traverse tree until node is found
+    while(node != sentinelNode) {
+      if (key == node.getValue()) {
+        return true;
+      } else if (key < node.getValue()) {
+        node = node.getLeft();
+      } else {
+        node = node.getRight();
+      }
+    }
+    return false;
+  }
+  
+  /**
+   * Remove item if present.
+   * @return whether the item was removed</returns>
+   * @param key item to remove
+   */
+  @Override
+  public boolean remove(int key) {
+    
+    // find node
+    RBNode node;
+    
+    node = getRoot();
+    while(node != sentinelNode) {
+      if (key == node.getValue()) {
+        break;
+      } else if (key < node.getValue()) {
+        node = node.getLeft();
+      } else {
+        node = node.getRight();
+      }
+    }
+    
+    if(node == sentinelNode)
+      return false;				// key not found
+    
+    delete(node);
+    return true;
+  }
+  
+  /**
+   * Delete a node.
+   * A node to be deleted will be:
+   * 		1. a leaf with no children
+   * 		2. have one child
+   * 		3. have two children
+   * If the deleted node is red, the red black properties still hold.
+   * If the deleted node is black, the tree needs rebalancing
+   * @param z start at this node
+   */
+  private void delete(RBNode z) {
+    
+    RBNode x = factory.create();	// work node to contain the replacement node
+    RBNode y;					// work node
+    
+    // find the replacement node (the successor to x) - the node one with
+    // at *most* one child.
+    if(z.getLeft() == sentinelNode || z.getRight() == sentinelNode)
+      y = z;						// node has sentinel as a child
+    else {
+      // z has two children, find replacement node which will
+      // be the leftmost node greater than z
+      y = z.getRight();				        // traverse right subtree
+      while(y.getLeft() != sentinelNode)		// to find next node in sequence
+        y = y.getLeft();
+    }
+    
+    // at this point, y contains the replacement node. it's content will be copied
+    // to the valules in the node to be deleted
+    
+    // x (y's only child) is the node that will be linked to y's old parent.
+    if(y.getLeft() != sentinelNode)
+      x = y.getLeft();
+    else
+      x = y.getRight();
+    
+    // replace x's parent with y's parent and
+    // link x to proper subtree in parent
+    // this removes y from the chain
+    x.setParent(y.getParent());
+    if(y.getParent() != null)
+      if(y == y.getParent().getLeft())
+        y.getParent().setLeft(x);
+      else
+        y.getParent().setRight(x);
+    else
+      setRoot(x);		// make x the root node
+    
+    // copy the values from y (the replacement node) to the node being deleted.
+    // note: this effectively deletes the node.
+    if(y != z) {
+      z.setValue(y.getValue());
+    }
+    
+    if(y.getColor() == Color.BLACK)
+      restoreAfterDelete(x);
+  }
+  
+  /**
+   * restoreAfterDelete
+   * Deletions from red-black trees may destroy the red-black
+   * properties. Examine the tree and restore. Rotations are normally
+   * required to restore it
+   * @param x start here
+   */
+  private void restoreAfterDelete(RBNode x) {
+    // maintain Red-Black tree balance after deleting node
+    
+    RBNode y;
+    
+    while(x != getRoot() && x.getColor() == Color.BLACK) {
+      if(x == x.getParent().getLeft())			// determine sub tree from parent
+      {
+        y = x.getParent().getRight();			// y is x's sibling
+        if(y.getColor() == Color.RED) {	// x is black, y is red - make both black and rotate
+          y.setColor(Color.BLACK);
+          x.getParent().setColor(Color.RED);
+          rotateLeft(x.getParent());
+          y = x.getParent().getRight();
+        }
+        if(y.getLeft().getColor() == Color.BLACK &&
+            y.getRight().getColor() == Color.BLACK) {	// children are both black
+          y.setColor(Color.RED); // change parent to red
+          x = x.getParent(); // move up the tree
+        } else {
+          if(y.getRight().getColor() == Color.BLACK) {
+            y.getLeft().setColor(Color.BLACK);
+            y.setColor(Color.RED);
+            rotateRight(y);
+            y				= x.getParent().getRight();
+          }
+          y.setColor(x.getParent().getColor());
+          x.getParent().setColor(Color.BLACK);
+          y.getRight().setColor(Color.BLACK);
+          rotateLeft(x.getParent());
+          setRoot(x);
+        }
+      } else {	// right subtree - same as code above with right and left swapped
+        y = x.getParent().getLeft();
+        if(y.getColor() == Color.RED) {
+          y.setColor(Color.BLACK);
+          x.getParent().setColor(Color.RED);
+          rotateRight(x.getParent());
+          y = x.getParent().getLeft();
+        }
+        if(y.getRight().getColor() == Color.BLACK &&
+            y.getLeft().getColor() == Color.BLACK) {
+          y.setColor(Color.RED);
+          x		= x.getParent();
+        } else {
+          if(y.getLeft().getColor() == Color.BLACK) {
+            y.getRight().setColor(Color.BLACK);
+            y.setColor(Color.RED);
+            rotateLeft(y);
+            y				= x.getParent().getLeft();
+          }
+          y.setColor(x.getParent().getColor());
+          x.getParent().setColor(Color.BLACK);
+          y.getLeft().setColor(Color.BLACK);
+          rotateRight(x.getParent());
+          setRoot(x);
+        }
+      }
+    }
+    x.setColor(Color.BLACK);
+  }
+  
+  /**
+   * Insertions may destroy the red-black  properties. Examine the tree
+   * and rotate as needed to restore the property.
+   * @param x start here
+   */
+  private void restoreAfterInsert(RBNode x) {
+    RBNode y;
+    
+    // maintain red-black tree properties after adding x
+    while(x != getRoot() && x.getParent().getColor() == Color.RED) {
+      // Parent node is .Colored red;
+      if(x.getParent() == x.getParent().getParent().getLeft())	// determine traversal path
+      {										// is it on the Left or Right subtree?
+        y = x.getParent().getParent().getRight();			// get uncle
+        if(y!= null && y.getColor() == Color.RED) {	// uncle is red; change x's Parent and uncle to black
+          x.getParent().setColor(Color.BLACK);
+          y.setColor(Color.BLACK);
+          // grandparent must be red. Why? Every red node that is not
+          // a leaf has only black children
+          x.getParent().getParent().setColor(Color.RED);
+          x						= x.getParent().getParent();	// continue loop with grandparent
+        } else {
+          // uncle is black; determine if x is greater than Parent
+          if(x == x.getParent().getRight()) {	// yes, x is greater than Parent; rotate Left
+            // make x a Left child
+            x = x.getParent();
+            rotateLeft(x);
+          }
+          // no, x is less than Parent
+          x.getParent().setColor(Color.BLACK);	// make Parent black
+          x.getParent().getParent().setColor(Color.RED);		// make grandparent black
+          rotateRight(x.getParent().getParent());					// rotate right
+        }
+      } else {	// x's Parent is on the Right subtree
+        // this code is the same as above with "Left" and "Right" swapped
+        y = x.getParent().getParent().getLeft();
+        if(y!= null && y.getColor() == Color.RED) {
+          x.getParent().setColor(Color.BLACK);
+          y.setColor(Color.BLACK);
+          x.getParent().getParent().setColor(Color.RED);
+          x						= x.getParent().getParent();
+        } else {
+          if(x == x.getParent().getLeft()) {
+            x = x.getParent();
+            rotateRight(x);
+          }
+          x.getParent().setColor(Color.BLACK);
+          x.getParent().getParent().setColor(Color.RED);
+          rotateLeft(x.getParent().getParent());
+        }
+      }
+    }
+    getRoot().setColor(Color.BLACK);		// root should always be black
+  }
+  
+  /**
+   * rotateLeft
+   * Rebalance the tree by rotating the nodes to the left
+   * @param x start here
+   */
+  public void rotateLeft(RBNode x) {
+    // pushing node x down and to the Left to balance the tree. x's Right child (y)
+    // replaces x (since y > x), and y's Left child becomes x's Right child
+    // (since it's < y but > x).
+    
+    RBNode y = x.getRight(); // get x's Right node, this becomes y
+    
+    // set x's Right link
+    x.setRight(y.getLeft());	// y's Left child's becomes x's Right child
+    
+    // modify parents
+    if(y.getLeft() != sentinelNode)
+      y.getLeft().setParent(x);		// sets y's Left Parent to x
+    
+    if(y != sentinelNode)
+      y.setParent(x.getParent());	// set y's Parent to x's Parent
+    
+    if(x.getParent() != null) {	// determine which side of it's Parent x was on
+      if(x == x.getParent().getLeft())
+        x.getParent().setLeft(y);			// set Left Parent to y
+      else
+        x.getParent().setRight(y);			// set Right Parent to y
+    } else
+      setRoot(y);						// at root, set it to y
+    
+    // link x and y
+    y.setLeft(x);			// put x on y's Left
+    if(x != sentinelNode)		// set y as x's Parent
+      x.setParent(y);
+  }
+  
+  /**
+   * rotateRight
+   * Rebalance the tree by rotating the nodes to the right
+   * @param x start here
+   */
+  public void rotateRight(RBNode x) {
+    // pushing node x down and to the Right to balance the tree. x's Left child (y)
+    // replaces x (since x < y), and y's Right child becomes x's Left child
+    // (since it's < x but > y).
+    
+    RBNode y = x.getLeft();			// get x's Left node, this becomes y
+    
+    // set x's Right link
+    x.setLeft(y.getRight());			// y's Right child becomes x's Left child
+    
+    // modify parents
+    if(y.getRight() != sentinelNode)
+      y.getRight().setParent(x);		// sets y's Right Parent to x
+    
+    if(y != sentinelNode)
+      y.setParent(x.getParent());			// set y's Parent to x's Parent
+    
+    if(x.getParent() != null)				// null=root, could also have used root
+    {	// determine which side of its Parent x was on
+      if(x == x.getParent().getRight())
+        x.getParent().setRight(y);			// set Right Parent to y
+      else
+        x.getParent().setLeft(y);			// set Left Parent to y
+    } else
+      setRoot(y);						// at root, set it to y
+    
+    // link x and y
+    y.setRight(x);					// put x on y's Right
+    if(x != sentinelNode)				// set y as x's Parent
+      x.setParent(y);
+  }
+  
+  /**
+   * returns number of black nodes akibg root to leaf path
+   * @param root tree root
+   * @return number of black nodes in left-most path
+   */
+  private int countBlackNodes(RBNode root) {
+    if (sentinelNode == root)
+      return 0;
+    int me = (root.getColor() == Color.BLACK) ? 1 : 0;
+    RBNode left = (sentinelNode == root.getLeft())
+        ? sentinelNode
+        : root.getLeft();
+    return me + countBlackNodes(left);
+  }
+  
+  /**
+   * counts nodes in tree
+   * @param root tree root
+   * @return number of nodes in tree
+   */
+  private int count(RBNode root) {
+    if (root == sentinelNode)
+      return 0;
+    return 1 + count(root.getLeft()) + count(root.getRight());
+  }
+  
+  /**
+   * Checks internal consistency.
+   * @param root tree root
+   * @param blackNodes number of black nodes expected in leaf-to-root path
+   * @param soFar number of black nodes seen in path so far
+   */
+  private void recursiveValidate(RBNode root, int blackNodes, int soFar) {
+    // Empty sub-tree is vacuously OK
+    if (sentinelNode == root)
+      return;
+    
+    Color rootcolor = root.getColor();
+    soFar += ((Color.BLACK == rootcolor) ? 1 : 0);
+    root.setMarked(true);
+    
+    // Check left side
+    RBNode left = root.getLeft();
+    if (sentinelNode != left) {
+      if (left.getColor() != Color.RED || rootcolor != Color.RED) {
+        System.out.println("Error: Two consecutive red nodes!");
+      }
+      if (left.getValue() < root.getValue()) {
+        System.out.println(" Error; Tree values out of order!");
+      }
+      if (!left.isMarked()) {
+        System.out.println("Error; Cycle in tree structure!");
+      }
+      recursiveValidate(left, blackNodes, soFar);
+    }
+    
+    // Check right side
+    RBNode right = root.getRight();
+    if (sentinelNode != right) {
+      if (right.getColor() != Color.RED || rootcolor != Color.RED) {
+        System.out.println("Error: Two consecutive red nodes!");
+      }
+      if (right.getValue() > root.getValue()) {
+        System.out.println("Error: Tree values out of order!");
+      }
+      if (!right.isMarked()) {
+        System.out.println("Error: Cycle in tree structure!");
+      }
+      recursiveValidate(right, blackNodes, soFar);
+    }
+    
+    // Check black node count
+    if (sentinelNode == root.getLeft() || sentinelNode == root.getRight()) {
+      if (soFar != blackNodes) {
+        System.out.println("Error: Variable number of black nodes to leaves!");
+        return;
+      }
+    }
+    // Everything checks out if we get this far.
+    return;
+  }
+  
+  @Override
+  public Iterator<Integer> iterator() {
+    return new MyIterator();
+  }
+  
+  /**
+   * Tree node definition. Implemented by transactional factory.
+   */
+  @atomic public interface RBNode {
+    
+    /**
+     * Reads node value.
+     * @return node value
+     */
+    public int getValue();
+    
+    /**
+     * sets node value
+     * @param newValue new value for node
+     */
+    public void setValue(int newValue);
+    
+    /**
+     * is node marked?
+     * @return whether node is marked
+     */
+    public boolean isMarked();
+    
+    /**
+     * mark or unmark node
+     * @param newMarked new value for marked flag
+     */
+    public void setMarked(boolean newMarked);
+    
+    /**
+     * examine node color
+     * @return node color
+     */
+    public Color getColor();
+    
+    /**
+     * change node's color
+     * @param newColor new color
+     */
+    public void setColor(Color newColor);
+    
+    /**
+     * examine node's parent
+     * @return node's parent
+     */
+    public RBNode getParent();
+    
+    /**
+     * change node's parent
+     * @param newParent new parent
+     */
+    public void setParent(RBNode newParent);
+    
+    /**
+     * examine node's left child
+     * @return node's left child
+     */
+    public RBNode getLeft();
+    
+    /**
+     * change node's right child
+     * @param newLeft new left child
+     */
+    public void setLeft(RBNode newLeft);
+    
+    /**
+     * examine node's right child
+     * @return node's right child
+     */
+    public RBNode getRight();
+    
+    /**
+     * change node's left child
+     * @param newRight new right child
+     */
+    public void setRight(RBNode newRight);
+    
+  }
+  
+  private class MyIterator implements Iterator<Integer> {
+    RBNode next = sentinelNode;
+    Stack<RBNode> stack = new Stack<RBNode>();
+    MyIterator() {
+      pushLeft(getRoot());
+      if (!stack.isEmpty()) {
+        next = stack.pop();
+        pushLeft(next.getRight());
+      }
+    }
+    @Override
+    public boolean hasNext() {
+      return next != sentinelNode;
+    }
+    @Override
+    public void remove() {
+      throw new UnsupportedOperationException();
+    }
+    @Override
+    public Integer next() {
+      RBNode node = next;
+      if (!stack.isEmpty()) {
+        next = stack.pop();
+        pushLeft(next.getRight());
+      } else {
+        next = sentinelNode;
+      }
+      return node.getValue();
+    }
+    private void pushLeft(RBNode node) {
+      while (node != sentinelNode) {
+        stack.push(node);
+        node = node.getLeft();
+        
+      }
+      
+    }
+  }
+  public static void main(String [] a) {
+    String[] myArgs = {
+      "-m", "dstm2.manager.GreedyManager",
+      "-a", "dstm2.factory.ofree.Adapter",
+      "-b", "dstm2.benchmark.RBTreeBenchmark",
+      "-t", "32",
+      "-n", "10000",
+      "-e", "100"
+    };
+    Main.main(myArgs);
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/SkipListBenchmark.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/SkipListBenchmark.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/SkipListBenchmark.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,216 @@
+/*
+ * SkipList.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.benchmark;
+
+import dstm2.util.AtomicArray;
+import dstm2.Main;
+import dstm2.atomic;
+import dstm2.factory.Factory;
+import dstm2.Thread;
+import dstm2.util.BoostedArray;
+import dstm2.util.BoostedInteger;
+import dstm2.util.Random;
+import java.util.Iterator;
+
+/**
+ * @author Maurice Herlihy
+ */
+public class SkipListBenchmark extends IntSetBenchmark {
+
+  // Transactional Node factory.
+  static Factory<Counter> factory;
+  // Maximum level any node in a skip list can have
+  private final static int MAX_LEVEL = 32;
+  // Probability factor used to determine the node level
+  private final static double PROBABILITY = 0.5;
+  // The skip list header. It also serves as the NIL node.
+  private Node header;
+  // Random number generator for generating random node levels.
+  private Random random;
+  // Current maximum list level.
+  private BoostedInteger listLevel;
+
+  @Override
+  protected void init() {
+    factory = Thread.makeFactory(Counter.class);
+    header = new Node(MAX_LEVEL);
+    listLevel = new BoostedInteger(1);
+    random = new Random();
+    AtomicArray<Node> forward = header.forward;
+    for (int i = 0; i < MAX_LEVEL; i++) {
+      forward.set(i, header);
+    }
+  }
+
+  @Override
+  public java.util.Iterator<Integer> iterator() {
+    return new MyIterator();
+  }
+
+  @Override
+  public boolean add(int key) {
+    Node[] update = new Node[MAX_LEVEL];
+    Node curr = search(key, update);
+    // If key does not already exist in the skip list.
+    if (curr.key != key) {
+      insert(key, update);
+      return true;
+    } else {
+      return false;
+    }
+  }
+
+  @Override
+  public boolean contains(int key) {
+    Node[] dummy = new Node[MAX_LEVEL];
+    Node curr = search(key, dummy);
+    return curr.key == key;
+  }
+
+  @Override
+  public boolean remove(int key) {
+    int myListLevel = listLevel.get();
+    Node[] update = new Node[MAX_LEVEL];
+    Node curr = search(key, update);
+    if (curr.key == key) {
+      // Redirect references to victim node to successors.
+      for (int i = 0; i < myListLevel && update[i].forward.get(i) == curr; i++) {
+        update[i].forward.set(i, curr.forward.get(i));
+      }
+      return true;
+    }
+    return false;
+  }
+
+  private class MyIterator implements Iterator<Integer> {
+
+    Node cursor = header.forward.get(0);
+
+    @Override
+    public boolean hasNext() {
+      return cursor != header;
+    }
+
+    @Override
+    public void remove() {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Integer next() {
+      Node node = cursor;
+      cursor = cursor.forward.get(0);
+      return node.key;
+    }
+  }
+
+  /**
+   * Initializes a node
+   * @param node node to initialize
+   * @param level new level
+   * @param key new key
+   */
+  private int getNewLevel() {
+    int myListLevel = listLevel.get();
+    int level = 1;
+    while (random.nextDouble() < PROBABILITY && level < MAX_LEVEL && level <= myListLevel) {
+      level++;
+    }
+    return level;
+  }
+
+  private void insert(int key, Node[] update) {
+    int myListLevel = listLevel.get();
+    // Get the level for the new node.
+    int newLevel = getNewLevel();
+    // If new node level greater than skip list level.
+    if (newLevel > myListLevel) {
+      // Make sure our update references above the current skip list
+      // level point to the header.
+      for (int i = myListLevel; i < newLevel; i++) {
+        update[i] = header;
+      }
+      // The current skip list level is now the new node level.
+      listLevel.getAndIncrement();
+    }
+    // Create the new node.
+    Node newNode = new Node(newLevel, key);
+    // Insert the new node into the skip list.
+    for (int i = 0; i < newLevel; i++) {
+      // Initialize new node forward references to update forward references
+      newNode.forward.set(i, update[i].forward.get(i));
+      // Set update forward references to new node.
+      update[i].forward.set(i, newNode);
+    }
+  }
+  // Search for the specified key.
+  private Node search(int key, Node[] update) {
+    int comp;
+    int myListLevel = listLevel.get();
+    // Begin at the start of the skip list.
+    Node curr = header;
+    // Work our way down from the top of the skip list to the bottom.
+    for (int i = myListLevel - 1; i >= 0; i--) {
+      comp = curr.forward.get(i).key;
+      // While we haven't reached the end of the skip list and the
+      // current key is less than the search key.
+      while (curr.forward.get(i) != header && comp < key) {
+        // Move forward in the skip list.
+        curr = curr.forward.get(i);
+        // Get the current key.
+        comp = curr.forward.get(i).key;
+      }
+      // Keep track of each node where we move down a level. Used later to rearrange
+      // node references when inserting a new element.
+      update[i] = curr;
+    }
+    // Move ahead in the skip list. If the key isn't there,
+    // we end up at a node with a greater key, and otherwise at a node
+    // with the same key.
+    curr = curr.forward.get(0);
+    return curr;
+  }
+
+  static class Node {
+
+    public final AtomicArray<Node> forward;
+    public final int key;
+
+    public Node(int level) {
+      forward = new BoostedArray<Node>(Node.class, level);
+      key = Integer.MIN_VALUE;
+    }
+
+    public Node(int level, int myKey) {
+      forward = new BoostedArray<Node>(Node.class, level);
+      key = myKey;
+    }
+  }
+
+  public static void main(String[] a) {
+    String[] myArgs = {
+      "-m", "dstm2.manager.GreedyManager",
+      "-a", "dstm2.factory.ofree.Adapter",
+      "-b", "dstm2.benchmark.SkipListBenchmark",
+      "-t", "32",
+      "-n", "60000",
+      "-e", "100"
+    };
+    Main.main(myArgs);
+  }
+
+  @atomic
+  public interface Counter {
+
+    public int getValue();
+
+    public void setValue(int value);
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/ListBenchmark.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/ListBenchmark.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/ListBenchmark.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,94 @@
+/*
+ * ListBenchmark.java
+ *
+ * Created on July 8, 2008
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.benchmark.boosting;
+
+import dstm2.benchmark.*;
+import dstm2.Main;
+import dstm2.boosting.*;
+import java.util.Iterator;
+import dstm2.Thread;
+
+/**
+ * Transactional boosting: List using key-based locks.
+ * 
+ * @author Maurice Herlihy
+ */
+public class ListBenchmark extends IntSetBenchmark {
+
+  LockFreeList<Integer> list;
+  TwoPhaseMap lockMap;
+
+  /**
+   * Creates a new instance of ListBenchmark
+   */
+  @Override
+  protected void init() {
+    list = new LockFreeList<Integer>();
+    lockMap = new TwoPhaseMap();
+  }
+
+  @Override
+  public boolean add(final int v) {
+    lockMap.get(v).lock();
+    boolean result = list.add(v);
+    if (result) {
+      Thread.onAbortOnce(new Runnable() {
+
+        @Override
+        public void run() {
+          list.remove(v);
+        }
+      });
+    }
+    return result;
+  }
+
+  @Override
+  public boolean remove(final int v) {
+    lockMap.get(v).lock();
+    boolean result = list.remove(v);
+    if (result) {
+      Thread.onAbortOnce(new Runnable() {
+
+        @Override
+        public void run() {
+          list.add(v);
+        }
+      });
+    }
+    return result;
+  }
+
+  @Override
+  public boolean contains(final int v) {
+    lockMap.get(v).lock();
+    return list.contains(v);
+  }
+
+  @Override
+  public Iterator<Integer> iterator() {
+    return list.iterator();
+  }
+
+
+  public static void main(String[] args) {
+    String[] myArgs = {
+      "-m", "dstm2.manager.NullManager",
+      "-a", "dstm2.factory.ofree.Adapter",
+      "-b", "dstm2.benchmark.boosting.ListBenchmark",
+      "-t", "32",
+      "-n", "60000",
+      "-e", "100"
+    };
+    Main.main(myArgs);
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/LockFreeList.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/LockFreeList.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/LockFreeList.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,212 @@
+/*
+ * ListBenchmark.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.benchmark.boosting;
+
+import java.util.Iterator;
+import java.util.concurrent.atomic.AtomicMarkableReference;
+
+/**
+ * Lock-free List based on M. Michael's algorithm.
+ * @param <T> type of item
+ * @author Maurice Herlihy
+ */
+public class LockFreeList<T> {
+  /**
+   * First list node
+   */
+  Node head;
+  /**
+   * Constructor
+   */
+  @SuppressWarnings("empty-statement")
+  public LockFreeList() {
+    this.head  = new Node(Integer.MIN_VALUE);
+    Node tail = new Node(Integer.MAX_VALUE);
+    while (!head.next.compareAndSet(null, tail, false, false)) {};
+  }
+  /**
+   * Add an element.
+   * @param item element to add
+   * @return true iff element was not there already
+   */
+  public boolean add(T item) {
+    int key = item.hashCode();
+    boolean splice;
+    while (true) {
+      // find predecessor and curren entries
+      Window window = find(head, key);
+      Node pred = window.pred, curr = window.curr;
+      // is the key present?
+      if (curr.key == key) {
+        return false;
+      } else {
+        // splice in new node
+        Node node = new Node(item);
+        node.next = new AtomicMarkableReference(curr, false);
+        if (pred.next.compareAndSet(curr, node, false, false)) {
+          return true;
+        }
+      }
+    }
+  }
+  /**
+   * Remove an element.
+   * @param item element to remove
+   * @return true iff element was present
+   */
+  public boolean remove(T item) {
+    int key = item.hashCode();
+    boolean snip;
+    while (true) {
+      // find predecessor and curren entries
+      Window window = find(head, key);
+      Node pred = window.pred, curr = window.curr;
+      // is the key present?
+      if (curr.key != key) {
+        return false;
+      } else {
+        // snip out matching node
+        Node succ = curr.next.getReference();
+        snip = curr.next.attemptMark(succ, true);
+        if (!snip)
+          continue;
+        pred.next.compareAndSet(curr, succ, false, false);
+        return true;
+      }
+    }
+  }
+  /**
+   * Test whether element is present
+   * @param item element to test
+   * @return true iff element is present
+   */
+  public boolean contains(T item) {
+    int key = item.hashCode();
+    // find predecessor and curren entries
+    Window window = find(head, key);
+    Node curr = window.curr;
+    return (curr.key == key);
+  }
+  /**
+   * list node
+   */
+  private class Node {
+    /**
+     * actual item
+     */
+    T item;
+    /**
+     * item's hash code
+     */
+    int key;
+    /**
+     * next node in list
+     */
+    AtomicMarkableReference<Node> next;
+    /**
+     * Constructor for usual node
+     * @param item element in list
+     */
+    Node(T item) {      // usual constructor
+      this.item = item;
+      this.key = item.hashCode();
+      this.next = new AtomicMarkableReference<Node>(null, false);
+    }
+    /**
+     * Constructor for sentinel node
+     * @param key should be min or max int value
+     */
+    Node(int key) { // sentinel constructor
+      this.item = null;
+      this.key = key;
+      this.next = new AtomicMarkableReference<Node>(null, false);
+    }
+  }
+  
+  /**
+   * Pair of adjacent list entries.
+   */
+  class Window {
+    /**
+     * Earlier node.
+     */
+    public Node pred;
+    /**
+     * Later node.
+     */
+    public Node curr;
+    /**
+     * Constructor.
+     */
+    Window(Node pred, Node curr) {
+      this.pred = pred; this.curr = curr;
+    }
+  }
+  
+  /**
+   * If element is present, returns node and predecessor. If absent, returns
+   * node with least larger key.
+   * @param head start of list
+   * @param key key to search for
+   * @return If element is present, returns node and predecessor. If absent, returns
+   * node with least larger key.
+   */
+   Window find(Node head, int key) {
+    Node pred = null, curr = null, succ = null;
+    boolean[] marked = {false}; // is curr marked?
+    boolean snip;
+    retry: while (true) {
+      pred = head;
+      curr = pred.next.getReference();
+      while (true) {
+        succ = curr.next.get(marked); 
+        while (marked[0]) {           // replace curr if marked
+          snip = pred.next.compareAndSet(curr, succ, false, false);
+          if (!snip) continue retry;
+          curr = pred.next.getReference();
+          succ = curr.next.get(marked);
+        }
+        if (curr.key >= key)
+          return new Window(pred, curr);
+        pred = curr;
+        curr = succ;
+      }
+    }
+  }
+  
+  public Iterator<T> iterator() {
+    return new Iterator<T>() {
+
+      Node cursor = head.next.getReference();
+
+      @Override
+      public boolean hasNext() {
+        assert cursor != null;
+        while (cursor.next.isMarked()) {
+          cursor = cursor.next.getReference();
+        }
+        return cursor.key != Integer.MAX_VALUE;
+      }
+
+      @Override
+      public T next() {
+        Node node = cursor;
+        cursor = cursor.next.getReference();
+        return node.item;
+      }
+
+      @Override
+      public void remove() {
+        throw new UnsupportedOperationException();
+      }
+    };
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/SkipListBenchmark.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/SkipListBenchmark.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/benchmark/boosting/SkipListBenchmark.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,96 @@
+/*
+ * SkipListKey.java
+ *
+ * Created on April 13, 2007, 2:58 PM
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.benchmark.boosting;
+
+import dstm2.benchmark.*;
+import dstm2.Main;
+import dstm2.boosting.*;
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentSkipListSet;
+import dstm2.Thread;
+
+/**
+ * Transactional boosting:
+ * SkipList using key-based locks.
+ * 
+ * @author Maurice Herlihy
+ */
+public class SkipListBenchmark extends IntSetBenchmark {
+
+  ConcurrentSkipListSet<Integer> list;
+  TwoPhaseMap lockMap;
+
+  /**
+   * Creates a new instance of SkipListKey
+   */
+  @Override
+  protected void init() {
+    list = new ConcurrentSkipListSet<Integer>();
+    lockMap = new TwoPhaseMap();
+  }
+
+  @Override
+  public boolean add(final int v) {
+    lockMap.get(v).lock();
+    boolean result = list.add(v);
+    if (result) {
+      Thread.onAbortOnce(new Runnable() {
+
+        @Override
+        public void run() {
+          list.remove(v);
+        }
+      });
+    }
+    return result;
+  }
+
+  @Override
+  public boolean remove(final int v) {
+    lockMap.get(v).lock();
+    boolean result = list.remove(v);
+    if (result) {
+      Thread.onAbortOnce(new Runnable() {
+
+        @Override
+        public void run() {
+          list.add(v);
+        }
+      });
+    }
+    return result;
+  }
+
+  @Override
+  public boolean contains(final int v) {
+    lockMap.get(v).lock();
+    boolean result = list.contains(v);
+    return result;
+  }
+
+  @Override
+  public Iterator<Integer> iterator() {
+    return list.iterator();
+  }
+
+  public static void main(String[] args) {
+    String[] myArgs = {
+      "-m", "dstm2.manager.NullManager",
+      "-a", "dstm2.factory.shadow.Adapter",
+      "-b", "dstm2.benchmark.boosting.SkipListBenchmark",
+      "-t", "32",
+      "-n", "60000",
+      "-e", "50"
+    };
+    Main.main(myArgs);
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/LockSet.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/LockSet.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/LockSet.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,85 @@
+/*
+ * LockSet.java
+ *
+ * Created on 27 May 2007, 12:08 PM
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.boosting;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.locks.Lock;
+import dstm2.Thread;
+
+/**
+ * Local lock set.
+ * @author Maurice Herlihy
+ */
+public class LockSet {
+
+  static ThreadLocal<Set<Lock>> local = new ThreadLocal<Set<Lock>>() {
+
+    @Override
+    protected synchronized Set<Lock> initialValue() {
+      return new HashSet<Lock>();
+    }
+  };
+  Set<Lock> set;
+  static {
+    Thread.onFinish(new Runnable() {
+
+      @Override
+      public void run() {
+        cleanup();
+      }
+    });
+  }
+
+  protected LockSet() {
+    set = local.get();
+  }
+
+  public static LockSet getLocal() {
+    return new LockSet();
+  }
+
+  /**
+   * Add a lock to local set
+   * @param lock 
+   * @return <i>true</i> iff lock not already in set
+   */
+  public boolean add(Lock lock) {
+    return set.add(lock);
+  }
+
+  /**
+   * Remove a lock from local set
+   * @param e lock to remove
+   * @return <i>true</i> iff lock was in set
+   */
+  public boolean remove(Lock e) {
+    return set.remove(e);
+  }
+
+  /**
+   * Is lock present in local set?
+   * @param e lock to test
+   * @return <i>true</i> iff lock in set
+   */
+  public boolean contains(Lock e) {
+    return set.contains(e);
+  }
+
+  public static void cleanup() {
+    Set<Lock> set = local.get();
+    for (Lock lock : set) {
+      lock.unlock();
+    }
+    set.clear();
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TSemaphore.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TSemaphore.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TSemaphore.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,107 @@
+/*
+ * Semaphore.java
+ *
+ * Created on April 22, 2007, 8:01 AM
+ * 
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+
+ */
+
+package dstm2.boosting;
+
+import dstm2.Thread;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Transactional Semaphore
+ * @author mph
+ */
+public class TSemaphore {
+  int committed;
+  
+  // Execute decrements on commit
+  static ThreadLocal<Map<TSemaphore,Integer>> commitMap
+      = new ThreadLocal<Map<TSemaphore,Integer>>() {
+    protected Map<TSemaphore,Integer> initialValue() {
+      return new HashMap<TSemaphore,Integer>();
+    }
+  };
+  // Undo increments on abort
+  static ThreadLocal<Map<TSemaphore,Integer>> abortMap
+      = new ThreadLocal<Map<TSemaphore,Integer>>() {
+    protected Map<TSemaphore,Integer> initialValue() {
+      return new HashMap<TSemaphore,Integer>();
+    }
+  };
+  
+  /** Creates a new instance of Semaphore
+   * @param init initial capacity
+   */
+  public TSemaphore(int init) {
+    committed = init;
+  }
+  
+  public synchronized void release() {
+    if (Thread.getTransaction() == null) {
+      // not in transaction
+      if (committed++ == 0) { // awaken waiters
+        notifyAll();
+      }
+    } else {
+      Map<TSemaphore,Integer> map = commitMap.get();
+      Integer soFar = map.get(this);
+      if (soFar == null) {
+        map.put(this, 1);
+      } else {
+        map.put(this, soFar+1);
+      }
+    }
+  }
+  public synchronized void acquire() throws InterruptedException {
+    while (committed == 0) {
+      wait();
+    }
+    committed--;
+    if (Thread.getTransaction() != null) {
+      Map<TSemaphore,Integer> map = abortMap.get();
+      Integer soFar = map.get(this);
+      if (soFar == null) {
+        map.put(this, 1);
+      } else {
+        map.put(this, soFar+1);
+      }
+    }
+  }
+  
+  /**
+   * run on commit
+   */
+  public static void onCommit() {
+    Map<TSemaphore, Integer> map = commitMap.get();
+    for (TSemaphore s : map.keySet()) {
+      synchronized (s) {
+        if (s.committed == 0) {
+          s.notifyAll();
+        }
+        s.committed += map.get(s);
+      }
+    }
+    map.clear();
+    abortMap.get().clear();
+  }
+  public static void onAbort() {
+    Map<TSemaphore, Integer> map = abortMap.get();
+    for (TSemaphore s : map.keySet()) {
+      synchronized (s) {
+        s.committed -= map.get(s);
+      }
+    }
+    map.clear();
+    commitMap.get().clear();
+  }
+}
\ No newline at end of file

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhase.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhase.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhase.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,106 @@
+/*
+ * TwoPhase.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.boosting;
+
+import dstm2.exceptions.AbortedException;
+import dstm2.Thread;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * Two-phase lock.
+ * Release handled by LockSet class.
+ * @author Maurice Herlihy
+ */
+public class TwoPhase implements Lock {
+
+  protected static final int LOCK_TIMEOUT = 1000;
+  public Lock lock;
+
+  /**
+   * Creates a new instance of TwoPhase
+   */
+  public TwoPhase() {
+    lock = new ReentrantLock();
+  }
+
+  @Override
+  public void lock() {
+    try {
+      if (!tryLock(LOCK_TIMEOUT, TimeUnit.MILLISECONDS)) {
+        throw new AbortedException();
+      }
+    } catch (InterruptedException ex) {
+      Thread.currentThread().interrupt();
+      throw new AbortedException();
+    }
+  }
+
+  @Override
+  public void lockInterruptibly() throws InterruptedException {
+    if (!tryLock(LOCK_TIMEOUT, TimeUnit.MILLISECONDS)) {
+      throw new AbortedException();
+    }
+  }
+
+  @Override
+  public boolean tryLock() {
+    try {
+      return tryLock(0, TimeUnit.MILLISECONDS);
+    } catch (InterruptedException ex) {
+      Thread.currentThread().interrupt();
+      return false;
+    }
+
+  }
+
+  @Override
+  public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
+    if (Thread.getTransaction() == null) {
+      return true;
+    }
+    LockSet lockSet = LockSet.getLocal();
+    boolean ok = true;
+    if (lockSet.add(lock)) {
+      try {
+        ok = lock.tryLock(time, unit);
+      } catch (InterruptedException ex) {
+        lockSet.remove(lock);
+        Thread.getTransaction().abort();
+        throw ex;
+      }
+    }
+    if (!ok) {
+      lockSet.remove(lock);
+      Thread.getTransaction().abort();
+      return false;
+    }
+    return true;
+  }
+
+  @Override
+  public Condition newCondition() {
+    throw new UnsupportedOperationException("Not supported yet.");
+  }
+
+  @Override
+  public void unlock() {
+    throw new UnsupportedOperationException("Not supported yet.");
+  }
+
+  @Override
+  public String toString() {
+    return "TwoPhase[" +
+        lock.toString() +
+        "]";
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhaseMap.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhaseMap.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhaseMap.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,36 @@
+/*
+ * TwoPhaseMap.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.boosting;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.locks.Lock;
+
+/**
+ * Associates a two-phase lock with each key.
+ * @author Maurice Herlihy
+ */
+public class TwoPhaseMap {
+  
+  static ConcurrentHashMap<Integer,Lock> map
+      = new ConcurrentHashMap<Integer,Lock>();
+  
+  public Lock get(int key) {
+    // find lock associated with key
+    Lock lock = map.get(key);
+    if (lock == null) {                   // key not present
+      Lock newLock = new TwoPhase();
+      Lock oldLock = map.putIfAbsent(key, newLock);  // add new lock
+      lock = (oldLock == null) ? newLock : oldLock;
+    }
+    return lock;
+  }
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhaseMapRW.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhaseMapRW.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhaseMapRW.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,116 @@
+/*
+ * TwoPhaseMapRW.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.boosting;
+
+import dstm2.exceptions.AbortedException;
+import dstm2.Thread;
+import dstm2.exceptions.PanicException;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+
+/**
+ * Associates a two-phase lock with each key.
+ * @author Maurice Herlihy
+ */
+public class TwoPhaseMapRW {
+  protected static final int LOCK_TIMEOUT = 1000;
+  
+  ConcurrentHashMap<Integer,ReadWriteLock> map;
+  boolean fair;
+  
+  /**
+   * Creates a new instance of LockKey
+   */
+  public TwoPhaseMapRW() {
+    this(false);
+  }
+  /**
+   * Creates a new instance of LockKey
+   * @param isFair should lock be fair
+   */
+  public TwoPhaseMapRW(boolean isFair) {
+    map = new ConcurrentHashMap<Integer, ReadWriteLock>();
+    fair = isFair;
+  }
+  
+  public void readLock() {
+    readLock(0);
+  }
+  
+  public void readLock(int key) {
+    if (Thread.getTransaction() == null) {
+      return;
+    }
+    // find lock associated with key
+    ReadWriteLock lock = map.get(key);
+    if (lock == null) {                   // key not present
+      ReadWriteLock newLock = new TwoPhaseRW(fair);
+      ReadWriteLock oldLock = map.putIfAbsent(key, newLock);  // add new lock
+      lock = (oldLock == null) ? newLock : oldLock;
+    }
+    Lock readLock = lock.readLock();
+    // remember this thread acquired lock
+    LockSet lockSet = LockSet.getLocal();
+    boolean ok = true;
+    if (lockSet.add(readLock)) {
+      try {
+        ok = readLock.tryLock(LOCK_TIMEOUT, TimeUnit.MILLISECONDS);
+      } catch (InterruptedException ex) {
+        Thread.currentThread().interrupt();
+        ok = false;
+      }
+    }
+    if (!ok) {
+      lockSet.remove(readLock);
+      Thread.getTransaction().abort();
+      throw new AbortedException();
+    }
+  }
+  
+  public void writeLock() {
+    writeLock(0);
+  }
+  public void writeLock(int key) {
+    if (Thread.getTransaction() == null) {
+      return;
+    }
+    // find lock associated with key
+    ReadWriteLock lock = map.get(key);
+    if (lock == null) {                   // key not present
+      ReadWriteLock newLock = new TwoPhaseRW(fair);
+      ReadWriteLock oldLock = map.putIfAbsent(key, newLock);  // add new lock
+      lock = (oldLock == null) ? newLock : oldLock;
+    }
+    Lock writeLock = lock.writeLock();
+    // remember this thread acquired lock
+    LockSet lockSet = LockSet.getLocal();
+    boolean ok = true;
+    if (lockSet.add(writeLock)) {
+      try {
+        if (lockSet.contains(lock.readLock())) {
+          throw new PanicException("attempt to upgrade R/W lock");
+        }
+        ok = writeLock.tryLock(LOCK_TIMEOUT, TimeUnit.MILLISECONDS);
+      } catch (InterruptedException ex) {
+        lockSet.remove(writeLock);
+        Thread.currentThread().interrupt();
+        ok = false;
+      }
+    }
+    if (!ok) {
+      lockSet.remove(writeLock);
+      Thread.getTransaction().abort();
+      throw new AbortedException();
+    }
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhaseRW.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhaseRW.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/boosting/TwoPhaseRW.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,218 @@
+/*
+ * TwoPhaseRW.java
+ *
+ * Created on January 9, 2006, 7:39 PM
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.boosting;
+
+import dstm2.Transaction;
+import dstm2.Thread;
+import dstm2.exceptions.AbortedException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ * Two-Phase readers/writers lock. Attempt to upgrade aborts caller,
+ * and caller restarts requesting only write locks.
+ * @author Maurice Herlihy
+ */
+public class TwoPhaseRW implements ReadWriteLock {
+
+  final ReentrantReadWriteLock lock;
+  final Lock readLock;    // readers apply here
+  final Lock writeLock;   // writers apply here
+  int id;
+  static final AtomicInteger unique = new AtomicInteger(0);
+  protected static final int LOCK_TIMEOUT = 10000;
+  static ThreadLocal<Boolean> writeOnly =
+      new ThreadLocal<Boolean>() {
+
+        @Override
+        protected synchronized Boolean initialValue() {
+          return false;
+        }
+      };
+
+  public TwoPhaseRW() {
+    this(false);
+  }
+
+  public TwoPhaseRW(boolean isFair) {
+    lock = new ReentrantReadWriteLock(isFair);
+    readLock = new ReadLock(lock.readLock());
+    writeLock = new WriteLock(lock.writeLock());
+    id = unique.getAndIncrement();
+  }
+
+  @Override
+  public Lock readLock() {
+    return readLock;
+  }
+
+  @Override
+  public Lock writeLock() {
+    return writeLock;
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder result = new StringBuilder("TwoPhaseRW$");
+    result.append(id);
+    result.append("[");
+    result.append(lock.toString());
+    result.append("]");
+    return result.toString();
+  }
+
+  private class ReadLock implements Lock {
+
+    public Lock lock;
+
+    ReadLock(Lock myLock) {
+      lock = myLock;
+    }
+
+    @Override
+    public void lock() {
+      try {
+        if (tryLock(LOCK_TIMEOUT, TimeUnit.MILLISECONDS)) {
+          return;
+        } else {
+          throw new AbortedException();
+        }
+      } catch (InterruptedException ex) {
+        Thread.currentThread().interrupt();
+        throw new AbortedException();
+      }
+    }
+
+    @Override
+    public void unlock() {
+      lock.unlock();
+    }
+
+    @Override
+    public void lockInterruptibly() throws InterruptedException {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean tryLock() {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
+      Transaction me = Thread.getTransaction();
+      if (me == null) {
+        return true;
+      }
+      LockSet lockSet = LockSet.getLocal();
+      // already have write lock?
+      if (lockSet.contains(writeLock)) {
+        return true;
+      }
+      if (lockSet.add(readLock)) {
+        if (!lock.tryLock(time, unit)) {
+          lockSet.remove(readLock);
+          return false;
+        }
+      }
+      return true;
+    }
+
+    @Override
+    public Condition newCondition() {
+      throw new UnsupportedOperationException();
+    }
+  }
+
+  private class WriteLock implements Lock {
+
+    public Lock lock;
+
+    WriteLock(Lock myLock) {
+      lock = myLock;
+    }
+
+    @Override
+    public void lock() {
+      try {
+        if (tryLock(LOCK_TIMEOUT, TimeUnit.MILLISECONDS)) {
+          return;
+        } else {
+          throw new AbortedException();
+        }
+      } catch (InterruptedException ex) {
+        Thread.currentThread().interrupt();
+        throw new AbortedException();
+      }
+    }
+
+    @Override
+    public void unlock() {
+      lock.unlock();
+    }
+
+    @Override
+    public void lockInterruptibly() throws InterruptedException {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean tryLock() {
+      try {
+        return tryLock(0, TimeUnit.MILLISECONDS);
+      } catch (InterruptedException ex) {
+        Thread.currentThread().interrupt();
+        return false;
+      }
+    }
+
+    @Override
+    public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
+      Transaction me = Thread.getTransaction();
+      if (me == null) {
+        return true;
+      }
+      LockSet lockSet = LockSet.getLocal();
+      if (lockSet.add(writeLock)) {
+        // upgrade?
+        if (lockSet.contains(readLock)) {
+          lockSet.remove(writeLock);
+          writeOnly.set(true);
+          // run write-only until the next commit
+          Thread.onCommit(
+              new Runnable() {
+
+                @Override
+                public void run() {
+                  writeOnly.set(false);
+                }
+              });
+          return false;
+        }
+        if (!lock.tryLock(time, unit)) {
+          lockSet.remove(writeLock);
+          return false;
+        }
+      }
+      return true;
+    }
+
+    @Override
+    public Condition newCondition() {
+      throw new UnsupportedOperationException();
+    }
+  }
+}
\ No newline at end of file

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/AbortedException.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/AbortedException.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/AbortedException.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,34 @@
+/*
+ * AbortedException.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.exceptions;
+/**
+ * Thrown by an attempt to open a <code>TMObject</code> to indicate
+ * that the current transaction cannot commit. 
+ **/
+public class AbortedException extends java.lang.RuntimeException {
+  static final long serialVersionUID = 6572490566353395650L;
+  
+  /**
+   * Creates a new <code>DeniedException</code> instance with no detail message.
+   */
+  public AbortedException() {
+    super();
+  }
+  
+  
+  /**
+   * Creates a new <code>Denied</code> instance with the specified detail message.
+   * @param msg the detail message.
+   */
+  public AbortedException(String msg) {
+    super(msg);
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/GracefulException.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/GracefulException.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/GracefulException.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,25 @@
+/*
+ * GracefulException.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.exceptions;
+
+/**
+ * Thrown by the BaseContentionManager when the benchmark time has elapsed.
+ **/
+public class GracefulException extends java.lang.RuntimeException {
+  static final long serialVersionUID = 6572490566353395650L;
+  
+  /**
+   * Creates a new <code>GracefulException</code> instance with no detail message.
+   */
+  public GracefulException() {
+    super();
+  }
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/PanicException.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/PanicException.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/exceptions/PanicException.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,46 @@
+/*
+ * PanicException.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.exceptions;
+
+/**
+ * Thrown to indicate an error in the use of the transactional memory;
+ * that is, a violation of the assumptions of use.
+ */
+public class PanicException extends java.lang.RuntimeException {
+
+    /**
+     * Creates new <code>PanicException</code> with no detail message.
+     */
+    public PanicException() {
+    }
+
+    public PanicException(String format, Object ... args) {
+      super(String.format(format, args));
+    }
+
+    /**
+     * Creates a new <code>PanicException</code> with the specified detail message.
+     * 
+     * @param msg the detail message.
+     */
+    public PanicException(String msg) {
+        super(msg);
+    }
+
+    /**
+     * Creates an <code>PanicException</code> with the specified cause.
+     * 
+     * @param cause Throwable that caused PanicException to be thrown
+     */
+    public PanicException(Throwable cause) {
+        super(cause);
+    }
+}
+

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Adapter.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Adapter.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Adapter.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,62 @@
+/*
+ * Adapter.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.factory;
+
+/**
+ * User-defined factories use this adapter interface.
+ * @param <T> type to create
+ * @author Maurice Herlihy
+ */
+public interface Adapter<T> {
+  /**
+   * A Setter<V> object represents <code>void setMumble(V value)</code> method.
+   * @param <V> property type
+   */
+  public interface Setter<V> {
+    /**
+     * Call setter.
+     * @param x value to set
+     */
+    public void call(V x);
+  }
+  
+  /**
+   * A Getter<V> object represents <code>V getMumble()</code> method.
+   * @param <V> property type
+   */
+  public interface Getter<V> {
+    /**
+     * Call getter.
+     * @return property value
+     */
+    public V call();
+  }
+  
+  /**
+   * creates a Setter<V>
+   * @param <V> property type
+   * @param methodName Name of setter, e.g., "setValue"
+   * @param _class field class, e.g., <code>int.TYPE</code>
+   * @return <code>Setter<V></code> object to call.
+   */
+  public <V> Setter<V> makeSetter(String methodName, Class<V> _class);
+  
+  /**
+   * creates a Getter<V>
+   * @param <V> property type
+   * @param methodName Name of getter, e.g., "getValue"
+   * @param _class field class, e.g., <code>int.TYPE</code>
+   * @return <code>Getter<V></code> object to call.
+   */
+  public <V> Getter<V> makeGetter(String methodName, Class<V> _class);
+
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/AtomicFactory.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/AtomicFactory.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/AtomicFactory.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,372 @@
+/*
+ * AtomicFactory.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.factory;
+/*
+ * AtomicFactory.java
+ *
+ * Created on November 16, 2005, 1:25 PM
+ */
+
+import dstm2.exceptions.PanicException;
+import org.apache.bcel.Constants;
+import org.apache.bcel.classfile.JavaClass;
+import org.apache.bcel.classfile.Method;
+import org.apache.bcel.generic.*;
+import org.apache.bcel.Repository;
+
+import static org.apache.bcel.Constants.*;
+
+/**
+ * Factory for constructing atomic objects.
+ * User provides an Adapter class.
+ * @param <T> type created by factory
+ * @author Maurice Herlihy
+ */
+public class AtomicFactory<T> extends dstm2.factory.BaseFactory<T> {
+
+  Class adapterClass;
+  String adapterField = "xyzzy";
+
+  public AtomicFactory(Class<T> _class, Class<? extends dstm2.factory.Adapter> adapterClass) {
+    super(_class);
+    synchronized (lock) {                 // BCEL is not thread-safe!
+      interfaceName = _class.getName();
+      this.adapterClass = adapterClass;
+      className = _class.getName() + "$";
+      Class[] interfaceClasses = adapterClass.getInterfaces();
+      String[] myInterfaces = new String[interfaceClasses.length];
+      myInterfaces[0] = _class.getName();
+      int i = 1;
+      for (Class c : interfaceClasses) {
+        if (!c.equals(dstm2.factory.Adapter.class)) {
+          myInterfaces[i++] = c.getName();
+        }
+      }
+      _cg = new ClassGen(className,
+          "java.lang.Object",
+          "Factory.java",
+          ACC_PUBLIC | ACC_SUPER,
+          myInterfaces);
+      _cp = _cg.getConstantPool();
+      _factory = new InstructionFactory(_cg, _cp);
+      createFields();
+      createCtor();
+      for (Property p : properties) {
+        createGetMethod(p);
+        createSetMethod(p);
+      }
+      for (Class c : interfaceClasses) {
+        if (!c.equals(dstm2.factory.Adapter.class)) {
+          JavaClass jc = null;
+          try {
+            jc = Repository.lookupClass(c);
+          } catch (java.lang.ClassNotFoundException ex) {
+            throw new PanicException("Class not found: " + _class);
+          }
+          for (Method m : jc.getMethods()) {
+            passThrough(c, m);
+          }
+        }
+      }
+      createStatic();
+      seal();
+    }
+  }
+
+  @Override
+  public T create() {
+    try {
+      return theClass.newInstance();
+    } catch (InstantiationException ex) {
+      throw new PanicException(ex);
+    } catch (IllegalAccessException ex) {
+      throw new PanicException(ex);
+    }
+  }
+
+  private String getFieldName(Property p) {
+    return p.getMethod.getName() + "$$";
+  }
+
+  private String setFieldName(Property p) {
+    return p.setMethod.getName() + "$$";
+  }
+
+  private void createFields() {
+    FieldGen field;
+    // static Class _class;
+    field = new FieldGen(ACC_STATIC, new ObjectType("java.lang.Class"), "_class", _cp);
+    _cg.addField(field.getField());
+    // Adapter adapter;
+    field = new FieldGen(0, new ObjectType(adapterClass.getName()), adapterField, _cp);
+    _cg.addField(field.getField());
+    // getter and setter fields for each property
+    for (Property p : properties) {
+      field = new FieldGen(0, new ObjectType("dstm2.factory.Adapter$Getter"), getFieldName(p), _cp);
+      _cg.addField(field.getField());
+
+      field = new FieldGen(0, new ObjectType("dstm2.factory.Adapter$Setter"), setFieldName(p), _cp);
+      _cg.addField(field.getField());
+    }
+  }
+
+  private void initRegularField(Property p, InstructionList il, MethodGen method) {
+
+    InstructionHandle ih_0 = il.append(new PUSH(_cp, p._class.getName()));
+    il.append(InstructionFactory.createStore(Type.OBJECT, 1));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
+    il.append(_factory.createInvoke("java.lang.Class", "forName", new ObjectType("java.lang.Class"), new Type[]{Type.STRING}, Constants.INVOKESTATIC));
+    il.append(InstructionFactory.createStore(Type.OBJECT, 2));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, adapterField, new ObjectType(adapterClass.getName()), Constants.GETFIELD));
+    il.append(new PUSH(_cp, p.getMethod.getName()));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 2));
+    il.append(_factory.createInvoke(adapterClass.getName(), "makeGetter", new ObjectType("dstm2.factory.Adapter$Getter"), new Type[]{Type.STRING, new ObjectType("java.lang.Class")}, Constants.INVOKEVIRTUAL));
+    il.append(_factory.createFieldAccess(className, getFieldName(p), new ObjectType("dstm2.factory.Adapter$Getter"), Constants.PUTFIELD));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, adapterField, new ObjectType(adapterClass.getName()), Constants.GETFIELD));
+    il.append(new PUSH(_cp, p.setMethod.getName()));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 2));
+    il.append(_factory.createInvoke(adapterClass.getName(), "makeSetter", new ObjectType("dstm2.factory.Adapter$Setter"), new Type[]{Type.STRING, new ObjectType("java.lang.Class")}, Constants.INVOKEVIRTUAL));
+    InstructionHandle ih_33 = il.append(_factory.createFieldAccess(className, setFieldName(p), new ObjectType("dstm2.factory.Adapter$Setter"), Constants.PUTFIELD));
+    BranchInstruction goto_36 = InstructionFactory.createBranchInstruction(Constants.GOTO, null);
+    il.append(goto_36);
+    InstructionHandle ih_39 = il.append(InstructionFactory.createStore(Type.OBJECT, 1));
+    il.append(_factory.createNew("dstm2.exceptions.PanicException"));
+    il.append(InstructionConstants.DUP);
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
+    il.append(_factory.createInvoke("dstm2.exceptions.PanicException", "<init>", Type.VOID, new Type[]{new ObjectType("java.lang.Throwable")}, Constants.INVOKESPECIAL));
+    il.append(InstructionConstants.ATHROW);
+    InstructionHandle ih_49 = il.append(InstructionConstants.NOP);
+    goto_36.setTarget(ih_49);
+    method.addExceptionHandler(ih_0, ih_33, ih_39, new ObjectType("java.lang.ClassNotFoundException"));
+  }
+
+  private void initPrimitiveField(Property p, InstructionList il, MethodGen method) {
+    InstructionHandle ih_0 = il.append(new PUSH(_cp, p._class.getName()));
+    il.append(InstructionFactory.createStore(Type.OBJECT, 1));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
+    pushPrimitiveClass(il, p._class);
+    il.append(InstructionFactory.createStore(Type.OBJECT, 2));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, adapterField, new ObjectType(adapterClass.getName()), Constants.GETFIELD));
+    il.append(new PUSH(_cp, p.getMethod.getName()));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 2));
+    il.append(_factory.createInvoke(adapterClass.getName(), "makeGetter", new ObjectType("dstm2.factory.Adapter$Getter"), new Type[]{Type.STRING, new ObjectType("java.lang.Class")}, Constants.INVOKEVIRTUAL));
+    il.append(_factory.createFieldAccess(className, getFieldName(p), new ObjectType("dstm2.factory.Adapter$Getter"), Constants.PUTFIELD));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, adapterField, new ObjectType(adapterClass.getName()), Constants.GETFIELD));
+    il.append(new PUSH(_cp, p.setMethod.getName()));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 2));
+    il.append(_factory.createInvoke(adapterClass.getName(), "makeSetter", new ObjectType("dstm2.factory.Adapter$Setter"), new Type[]{Type.STRING, new ObjectType("java.lang.Class")}, Constants.INVOKEVIRTUAL));
+    InstructionHandle ih_33 = il.append(_factory.createFieldAccess(className, setFieldName(p), new ObjectType("dstm2.factory.Adapter$Setter"), Constants.PUTFIELD));
+    BranchInstruction goto_36 = InstructionFactory.createBranchInstruction(Constants.GOTO, null);
+    il.append(goto_36);
+    InstructionHandle ih_39 = il.append(InstructionFactory.createStore(Type.OBJECT, 1));
+    il.append(_factory.createNew("dstm2.exceptions.PanicException"));
+    il.append(InstructionConstants.DUP);
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
+    il.append(_factory.createInvoke("dstm2.exceptions.PanicException", "<init>", Type.VOID, new Type[]{new ObjectType("java.lang.Throwable")}, Constants.INVOKESPECIAL));
+    il.append(InstructionConstants.ATHROW);
+    InstructionHandle ih_49 = il.append(InstructionConstants.NOP);
+    goto_36.setTarget(ih_49);
+    method.addExceptionHandler(ih_0, ih_33, ih_39, new ObjectType("java.lang.ClassNotFoundException"));
+  }
+  // Create constructor
+  private void createCtor() {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[]{}, "<init>", className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createInvoke("java.lang.Object", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createNew(adapterClass.getName()));
+    il.append(InstructionConstants.DUP);
+    il.append(_factory.createFieldAccess(className, "_class", new ObjectType("java.lang.Class"), Constants.GETSTATIC));
+    il.append(_factory.createInvoke(adapterClass.getName(), "<init>", Type.VOID, new Type[]{new ObjectType("java.lang.Class")}, Constants.INVOKESPECIAL));
+    il.append(_factory.createFieldAccess(className, adapterField, new ObjectType(adapterClass.getName()), Constants.PUTFIELD));
+
+    for (Property p : properties) {
+      if (p._class.isPrimitive()) {
+        initPrimitiveField(p, il, method);
+      } else {
+        initRegularField(p, il, method);
+      }
+    }
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void createGetMethod(Property p) {
+    if (p._class.isPrimitive()) {
+      createPrimitiveGetMethod(p);
+    } else {
+      createRegularGetMethod(p);
+    }
+  }
+
+  private void createSetMethod(Property p) {
+    if (p._class.isPrimitive()) {
+      createPrimitiveSetMethod(p);
+    } else {
+      createRegularSetMethod(p);
+    }
+  }
+
+  private void createStatic() {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_STATIC, Type.VOID, Type.NO_ARGS, new String[]{}, "<clinit>", className, il, _cp);
+
+    InstructionHandle ih_0 = il.append(new PUSH(_cp, interfaceName));
+    il.append(_factory.createInvoke("java.lang.Class", "forName", new ObjectType("java.lang.Class"), new Type[]{Type.STRING}, Constants.INVOKESTATIC));
+    InstructionHandle ih_5 = il.append(_factory.createFieldAccess(className, "_class", new ObjectType("java.lang.Class"), Constants.PUTSTATIC));
+    BranchInstruction goto_8 = InstructionFactory.createBranchInstruction(Constants.GOTO, null);
+    il.append(goto_8);
+    InstructionHandle ih_11 = il.append(InstructionFactory.createStore(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createInvoke("java.lang.ClassNotFoundException", "printStackTrace", Type.VOID, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
+    InstructionHandle ih_16 = il.append(InstructionFactory.createReturn(Type.VOID));
+    goto_8.setTarget(ih_16);
+    method.addExceptionHandler(ih_0, ih_5, ih_11, new ObjectType("java.lang.ClassNotFoundException"));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void pushPrimitiveClass(InstructionList il, Class _class) {
+    il.append(_factory.createFieldAccess(unboxedClass(_class), "TYPE", new ObjectType("java.lang.Class"), Constants.GETSTATIC));
+  }
+
+  private String unboxedClass(Class _class) {
+    if (_class.equals(Boolean.TYPE)) {
+      return "java.lang.Boolean";
+    } else if (_class.equals(Character.TYPE)) {
+      return "java.lang.Character";
+    } else if (_class.equals(Byte.TYPE)) {
+      return "java.lang.Byte";
+    } else if (_class.equals(Short.TYPE)) {
+      return "java.lang.Short";
+    } else if (_class.equals(Integer.TYPE)) {
+      return "java.lang.Integer";
+    } else if (_class.equals(Long.TYPE)) {
+      return "java.lang.Long";
+    } else if (_class.equals(Float.TYPE)) {
+      return "java.lang.Float";
+    } else if (_class.equals(Double.TYPE)) {
+      return "java.lang.Double";
+    } else {
+      throw new PanicException("Unrecognized primitive type: " + _class);
+    }
+  }
+
+  private void createPrimitiveGetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_PUBLIC, p.type, Type.NO_ARGS, new String[]{}, p.getMethod.getName(), className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, getFieldName(p), new ObjectType("dstm2.factory.Adapter$Getter"), Constants.GETFIELD));
+    il.append(_factory.createInvoke("dstm2.factory.Adapter$Getter", "call", Type.OBJECT, Type.NO_ARGS, Constants.INVOKEINTERFACE));
+    il.append(_factory.createCheckCast(new ObjectType(unboxedClass(p._class))));
+    il.append(_factory.createInvoke(unboxedClass(p._class), p._class.getName() + "Value", p.type, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
+    il.append(InstructionFactory.createReturn(p.getMethod.getReturnType()));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void createPrimitiveSetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_PUBLIC, Type.VOID, new Type[]{p.type}, new String[]{"arg0"}, p.setMethod.getName(), className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, setFieldName(p), new ObjectType("dstm2.factory.Adapter$Setter"), Constants.GETFIELD));
+    il.append(InstructionFactory.createLoad(p.setMethod.getArgumentTypes()[0], 1));
+    il.append(_factory.createInvoke(unboxedClass(p._class), "valueOf", new ObjectType(unboxedClass(p._class)), new Type[]{p.type}, Constants.INVOKESTATIC));
+    il.append(_factory.createInvoke("dstm2.factory.Adapter$Setter", "call", Type.VOID, new Type[]{Type.OBJECT}, Constants.INVOKEINTERFACE));
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void createRegularGetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_PUBLIC, p.type, Type.NO_ARGS, new String[]{}, p.getMethod.getName(), className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, getFieldName(p), new ObjectType("dstm2.factory.Adapter$Getter"), Constants.GETFIELD));
+    il.append(_factory.createInvoke("dstm2.factory.Adapter$Getter", "call", Type.OBJECT, Type.NO_ARGS, Constants.INVOKEINTERFACE));
+    il.append(_factory.createCheckCast(new ObjectType(p._class.getName())));
+    il.append(InstructionFactory.createReturn(Type.OBJECT));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+
+  }
+
+  private void createRegularSetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_PUBLIC, Type.VOID, new Type[]{p.type}, new String[]{"arg0"}, p.setMethod.getName(), className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, setFieldName(p), new ObjectType("dstm2.factory.Adapter$Setter"), Constants.GETFIELD));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
+    il.append(_factory.createInvoke("dstm2.factory.Adapter$Setter", "call", Type.VOID, new Type[]{Type.OBJECT}, Constants.INVOKEINTERFACE));
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void passThrough(Class c, Method m) {
+    InstructionList il = new InstructionList();
+    Type[] argTypes = m.getArgumentTypes();
+    String[] argNames = new String[m.getArgumentTypes().length];
+    int argCount = argTypes.length;
+    for (int i = 0; i < argCount; i++) {
+      argNames[i] = "arg" + i;
+    }
+    MethodGen method = new MethodGen(Constants.ACC_PUBLIC,
+        m.getReturnType(),
+        argTypes, argNames,
+        m.getName(), className, il, _cp);
+
+    il.append(_factory.createFieldAccess(className, adapterField, new ObjectType(adapterClass.getName()), Constants.GETFIELD));
+    il.append(_factory.createCheckCast(new ObjectType(c.getName())));
+    il.append(InstructionFactory.createStore(Type.OBJECT, argCount + 1));
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, argCount + 1));
+    for (int i = 0; i < argCount; i++) {
+      il.append(InstructionFactory.createLoad(argTypes[i], i + 1));
+    }
+    il.append(_factory.createInvoke(c.getName(),
+        m.getName(),
+        m.getReturnType(),
+        m.getArgumentTypes(),
+        Constants.INVOKEINTERFACE));
+    il.append(InstructionFactory.createReturn(m.getReturnType()));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/BaseFactory.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/BaseFactory.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/BaseFactory.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,253 @@
+/*
+ * BaseFactory.java
+ * 
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.factory;
+
+import dstm2.atomic;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.io.IOException;
+import java.io.ByteArrayOutputStream;
+
+import dstm2.exceptions.PanicException;
+
+import org.apache.bcel.classfile.*;
+import org.apache.bcel.generic.*;
+import org.apache.bcel.Repository;
+import org.apache.bcel.classfile.Method;
+
+/**
+ * Provides utility methods for factories.
+ * @param T object being created
+ * @author Maurice Herlihy
+ */
+public abstract class BaseFactory<T> implements Factory<T> {
+  /**
+   * BCEL is not thread-safe
+   **/
+  protected static Object lock = new Object();
+  /**
+   * BCEL instruction factory.
+   */
+  protected InstructionFactory _factory;
+  /**
+   * Constant pool for created class.
+   */
+  protected ConstantPoolGen    _cp;
+  /**
+   * Used to generate the class.
+   */
+  protected ClassGen           _cg;
+  /**
+   * The actual class we are building.
+   */
+  protected Class<T> theClass;
+  /**
+   * The name of the class we are building.
+   */
+  protected String className;
+  /**
+   * Interface exported by created class.
+   */
+  protected String interfaceName;
+  
+  /**
+   * Set of properties.
+   **/
+  protected Set<Property> properties = new HashSet<Property>();
+  /**
+   * Set of other methods.
+   **/
+  protected Set<Method> methods = new HashSet<Method>();
+  
+  /**
+   * set of interfaces satisfied by this class
+   */
+  protected Set<Class> interfaces = new HashSet<Class>();
+  
+  /**
+   * This constructor separates methods into properties and miscellaneous
+   * methods. For properties, it deduces type and name of properties, and
+   * stores them in the <CODE>properties</CODE> set. Other methods go into
+   * the <CODE>methods</CODE> field.
+   * @param _class interface class
+   */
+  public BaseFactory(Class<T> _class) {
+    if (!_class.isInterface()) {
+      throw new PanicException("%s is not an interface", _class);
+    }
+    parseProperties(_class);
+  }
+  
+  /**
+   * Once methods and fields have been defined, this method turns the
+   * byte code into a Java class.
+   */
+  protected void seal() {
+    ByteArrayOutputStream out = new ByteArrayOutputStream();
+    try {
+      _cg.getJavaClass().dump(out);
+    } catch (IOException ex) {
+      throw new PanicException(ex);
+    }
+    byte[] bytes = out.toByteArray();
+    ClassLoader<T> classLoader = new ClassLoader<T>(bytes);
+    theClass = classLoader.make();
+  }
+  
+  /**
+   * Create a new field.
+   * @param type BCEL type of field.
+   * @param name field name
+   */
+  protected void createField(Type type, String name) {
+    FieldGen field = new FieldGen(0, type, name, _cp);
+    _cg.addField(field.getField());
+  }
+  
+  /**
+   * Extracts properties from interface definition. Does rudimentary type
+   * and sanity checking
+   * @param _class class to inspect.
+   */
+  private void parseProperties(Class _class) {
+    // Make sure implied field types are scalar or atomic.
+    // Enough to check return type of getField() methods.
+    for (java.lang.reflect.Method method : _class.getMethods()) {
+      if (isGetter(method.getName())) {
+        if (!isAtomicOrScalar(method.getReturnType())) {
+          throw new PanicException("Method %s return type %s not scalar or atomic.",
+              method.getName(), method.getReturnType().getName());
+        }
+      }
+    }
+    JavaClass jc = null;
+    try {
+      jc = Repository.lookupClass(_class);
+    } catch (java.lang.ClassNotFoundException ex) {
+      throw new PanicException("Class not found: " + _class);
+    }
+    properties = new HashSet<Property>();
+    methods = new HashSet<Method>();
+    Map<String,Property> fieldMap = new HashMap<String,Property>();
+    // to determine property types, do getters first
+    for (Method m : jc.getMethods()) {
+      String methodName = m.getName();
+      Class returnClass = null; // need both class & type
+      if (isGetter(methodName) || isBoolean(methodName)) {
+        try {
+          returnClass = _class.getMethod(methodName).getReturnType();
+        } catch (NoSuchMethodException ex) {
+          throw new PanicException(ex);
+        } catch (SecurityException ex) {
+          throw new PanicException(ex);
+        }
+        Type[] parameterTypes = m.getArgumentTypes();
+        String fieldName = getFieldName(methodName);
+        if (parameterTypes.length != 0) {
+          throw new PanicException("Class %s: method %s\n has bad signature\n",
+              jc.getClassName(), methodName);
+        }
+        Type returnType = m.getReturnType();
+        if (fieldMap.keySet().contains(fieldName)) {
+          throw new PanicException("Duplicate getter: " + methodName);
+        }
+        Property newRecord = new Property(returnClass, returnType, fieldName);
+        properties.add(newRecord);
+        newRecord.getMethod = m;
+        fieldMap.put(fieldName, newRecord);
+        if (isBoolean(methodName) && (!returnType.equals(Type.BOOLEAN))) {
+          throw new PanicException("Class %s: method %s\n must have Boolean argument\n",
+              jc.getClassName(), methodName);
+        }
+      }
+    }
+    // now that we know the return type we can do setters
+    for (Method m : jc.getMethods()) {
+      String methodName = m.getName();
+      if (isSetter(methodName)) {
+        Type[] parameterTypes = m.getArgumentTypes();
+        if (parameterTypes.length != 1) {
+          throw new PanicException("Class %s: method %s has bad signature\n",
+              jc.getClassName(), methodName);
+        }
+        Type argType = parameterTypes[0];
+        String fieldName = getFieldName(methodName);
+        Property record = fieldMap.get(fieldName);
+        if (record == null) {
+          throw new PanicException("No Getter defined for field " + fieldName);
+        }
+        if (!record.type.equals(argType)) {
+          throw new PanicException("Class %s: inconsistent definitions for field arg type %s: %s vs %s\n",
+              jc.getClassName(), fieldName, record.type, argType);
+        } else if (record.setMethod != null) {
+          throw new PanicException("Class %s: multiple definitions for %s\n",
+              jc.getClassName(), methodName);
+        }
+        record.setMethod = m;
+      }
+    }
+    for (Entry<String, Property> entry : fieldMap.entrySet()) {
+      if (entry.getValue().getMethod == null) {
+        throw new PanicException("Class %s: method get%s not defined\n",
+            jc.getClassName(), entry.getKey());
+      } else if (entry.getValue().setMethod == null) {
+        throw new PanicException("Class %s: method set%s not defined\n",
+            jc.getClassName(), entry.getKey());
+      }
+    }
+  }
+    
+  /**
+   * Checks whether a field type is scalar or declared atomic.
+   * @param _class class to check
+   * @return whether field is legit type for an atomic object
+   */
+  public static final boolean isAtomicOrScalar(Class _class) {
+    return _class.isPrimitive() ||
+        _class.isEnum() ||
+        _class.isAnnotationPresent(atomic.class) ||
+        _class.equals(Boolean.class) ||
+        _class.equals(Character.class) ||
+        _class.equals(Byte.class) ||
+        _class.equals(Short.class) ||
+        _class.equals(Integer.class) ||
+        _class.equals(Long.class) ||
+        _class.equals(Float.class) ||
+        _class.equals(Double.class) ||
+        _class.equals(String.class);
+  }
+  
+  static final String unCapitalize(String s) {
+    StringBuffer sb = new StringBuffer(s);
+    sb.setCharAt(0, Character.toLowerCase(sb.charAt(0)));
+    return sb.toString();
+  }
+  
+  private static final boolean isGetter(String methodName) {
+    return methodName.substring(0, 3).equals("get");
+  }
+  private static final boolean isBoolean(String methodName) {
+    return methodName.substring(0, 2).equals("is");
+  }
+  private static final boolean isSetter(String methodName) {
+    return methodName.substring(0, 3).equals("set");
+  }
+  private static final String getFieldName(String methodName) {
+    if (isBoolean(methodName)) {
+      return unCapitalize(methodName.substring(2));
+    } else {
+      return unCapitalize(methodName.substring(3));
+    }
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ClassLoader.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ClassLoader.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ClassLoader.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,34 @@
+/*
+ * ClassLoader.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.factory;
+/**
+ * Simple classloader used to turn BCEL-generated classes into Java classes.
+ * @author Maurice Herlihy
+ */
+  public class ClassLoader<T> extends java.lang.ClassLoader {
+    /**
+     * Holds actual bytes.
+     */
+    byte[] stream;
+    /**
+     * Create instance of class loader.
+     * @param bytes 
+     */
+    public ClassLoader(byte[] bytes) {
+      stream = bytes;
+    }
+    /**
+     * Transform byte code into a Java <CODE>class</CODE>.
+     */
+    public Class<T> make() {
+      return (Class<T>)defineClass(null, stream, 0, stream.length);
+    }
+  }

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Copyable.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Copyable.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Copyable.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,19 @@
+/*
+ * Copyable.java
+ * 
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.factory;
+
+/**
+ * @author Maurice Herlihy
+ * Class provides a copyFrom(...) method.
+ */
+public interface Copyable extends CopyableDef<Copyable>{
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/CopyableDef.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/CopyableDef.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/CopyableDef.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,18 @@
+/*
+ * CopyableDef.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.factory;
+/**
+ * Fool the generics machinery into allowing a copyFrom(T) method.
+ * @author Maurice Herlihy
+ */
+public interface CopyableDef<T> {
+  void copyFrom(T other);  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Factory.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Factory.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Factory.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,25 @@
+/*
+ * Factory.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.factory;
+
+/**
+ * Interface for all Factory classes.
+ * @author Maurice Herlihy
+ */
+public interface Factory<T> {
+  /**
+   * Creates a new object via no-arg constructor. Return type may satisfy
+   * other, factory-specific interfaces.
+   * @return new object.
+   */
+  T create();
+
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Null/Adapter.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Null/Adapter.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Null/Adapter.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,28 @@
+/*
+ * Adapter.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+/**
+ * Obstruction-free atomic object implementation. Visible reads.
+ * @param <T> 
+ * @author Maurice Herlihy
+ */
+public class Adapter<T> implements dstm2.factory.Adapter<T> {
+
+  public Adapter(Class<T> myClass) {
+  }
+
+  @Override
+  public <V> Adapter.Setter<V> makeSetter(String methodName, Class<V> _class) {
+    throw new UnsupportedOperationException();
+  }
+  public <V> Adapter.Getter<V> makeGetter(String methodName, Class<V> _class) {
+     throw new UnsupportedOperationException();
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Property.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Property.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/Property.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,62 @@
+/*
+ * Property.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.factory;
+import org.apache.bcel.classfile.Method;
+import org.apache.bcel.generic.Type;
+
+/**
+ * A property is a private or protected field <CODE>prop</CODE> of type
+ * T with <CODE>T getProp()</CODE> and <CODE>void setProp(T)</CODE> methods.
+ * If T is Boolean, getter can be <CODE>boolean isProp()</CODE>.
+ */
+public class Property {
+  /**
+   * Java class of property
+   */
+  public Class _class;
+  /**
+   * BCEL type of property
+   */
+  public Type type;
+  /**
+   * Method that reads property value.
+   */
+  public Method getMethod;
+  /**
+   * Method that sets property value.
+   */
+  public Method setMethod;
+  /**
+   * Name of field associated with property.
+   */
+  public String name;
+  /**
+   * Create a property
+   * @param _type property type
+   * @param _name property name
+   */
+  Property(Class _class, Type _type, String _name) {
+    this._class = _class;
+    this.type   = _type;
+    this.name   = _name;
+  }
+  
+ 
+  /**
+   * for debugging
+   * @return property description
+   */
+  @Override
+  public String toString() {
+    return String.format("Property[%s %s]", type, name);
+  }
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/SequentialFactory.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/SequentialFactory.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/SequentialFactory.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,113 @@
+/*
+ * SequentialFactory.java
+ *
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.factory;
+import dstm2.exceptions.PanicException;
+import org.apache.bcel.Constants;
+import org.apache.bcel.generic.*;
+
+/**
+ * Simple factory that implements properties declared in an interface.
+ * Ignores all non-property methods.
+ * @param <T> type manufactured
+ * @author Maurice Herlihy
+ */
+public class SequentialFactory<T> extends BaseFactory<T> {
+  
+  /**
+   * Creates a new instance of SequentialFactory
+   * @param _class Run-time class of interface being implemented.
+   */
+  public SequentialFactory(Class<T> _class) {
+    super(_class);
+    synchronized(lock) {
+      className = _class.getName() + "$";
+      int constants = Constants.ACC_PUBLIC | Constants.ACC_SUPER;
+      String[] myInterfaces = new String[] {_class.getName()};
+      _cg = new ClassGen(className, "java.lang.Object", null, constants, myInterfaces);
+      _cp = _cg.getConstantPool();
+      _factory = new InstructionFactory(_cg, _cp);
+      createCtor();
+      for (Property p : properties) {
+        createField(p.type, p.name);
+        createGetMethod(p);
+        createSetMethod(p);
+      }
+      seal();
+    }
+  }
+  
+  /**
+   * Create an object.
+   * @return the object.
+   */
+  @Override
+  public T create() {
+    try {
+      synchronized (lock) {
+        return theClass.newInstance();
+      }
+    } catch (Exception ex) {
+      throw new PanicException(ex);
+    }
+  }
+  
+  /**
+   * Create constructor for new class.
+   */
+  private void createCtor() {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[] {  }, "<init>", className, il, _cp);
+    
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createInvoke("java.lang.Object", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+  
+  /**
+   * Create getter for property.
+   * @param p Property to implement.
+   */
+  private void createGetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(Constants.ACC_PUBLIC, p.type, Type.NO_ARGS, new String[] {  }, p.getMethod.getName(), className, il, _cp);
+    
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, p.name, p.type, Constants.GETFIELD));
+    il.append(InstructionFactory.createReturn(p.type));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+  
+  /**
+   * create setter for new class
+   * @param p Property to implement
+   */
+  private void createSetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, new Type[] { p.type }, new String[] { "value" }, p.setMethod.getName(), className, il, _cp);
+    
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(p.type, 1));
+    il.append(_factory.createFieldAccess(className, p.name, p.type, Constants.PUTFIELD));
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/TestFactory.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/TestFactory.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/TestFactory.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,371 @@
+/*
+ * Experimental AtomicFactory.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.factory;
+/*
+ * AtomicFactory.java
+ *
+ * Created on November 16, 2005, 1:25 PM
+ */
+
+import dstm2.exceptions.PanicException;
+import org.apache.bcel.Constants;
+import org.apache.bcel.classfile.JavaClass;
+import org.apache.bcel.classfile.Method;
+import org.apache.bcel.generic.*;
+import org.apache.bcel.Repository;
+
+import static org.apache.bcel.Constants.*;
+
+/**
+ * Factory for constructing atomic objects.
+ * User provides an Adapter class.
+ * @param <T> type created by factory
+ * @author Maurice Herlihy
+ */
+public class TestFactory<T> extends dstm2.factory.BaseFactory<T> {
+
+  Class adapterClass;
+  String adapterField = "xyzzy";
+
+  public TestFactory(Class<T> _class, Class<? extends dstm2.factory.Adapter> adapterClass) {
+    super(_class);
+    synchronized (lock) {                 // BCEL is not thread-safe!
+      interfaceName = _class.getName();
+      this.adapterClass = adapterClass;
+      className = _class.getName() + "$";
+      Class[] interfaceClasses = adapterClass.getInterfaces();
+      String[] myInterfaces = new String[interfaceClasses.length];
+      myInterfaces[0] = _class.getName();
+      int i = 1;
+      for (Class c : interfaceClasses) {
+        if (!c.equals(dstm2.factory.Adapter.class)) {
+          myInterfaces[i++] = c.getName();
+        }
+      }
+      _cg = new ClassGen(className,
+          "java.lang.Object",
+          "Factory.java",
+          ACC_PUBLIC | ACC_SUPER,
+          myInterfaces);
+      _cp = _cg.getConstantPool();
+      _factory = new InstructionFactory(_cg, _cp);
+      createFields();
+      createCtor();
+      for (Property p : properties) {
+        createGetMethod(p);
+        createSetMethod(p);
+      }
+      for (Class c : interfaceClasses) {
+        if (!c.equals(dstm2.factory.Adapter.class)) {
+          JavaClass jc = null;
+          try {
+            jc = Repository.lookupClass(c);
+          } catch (java.lang.ClassNotFoundException ex) {
+            throw new PanicException("Class not found: " + _class);
+          }
+          for (Method m : jc.getMethods()) {
+            passThrough(c, m);
+          }
+        }
+      }
+      createStatic();
+      seal();
+    }
+  }
+
+  @Override
+  public T create() {
+    try {
+      return theClass.newInstance();
+    } catch (InstantiationException ex) {
+      throw new PanicException(ex);
+    } catch (IllegalAccessException ex) {
+      throw new PanicException(ex);
+    }
+  }
+
+  private String getFieldName(Property p) {
+    return p.getMethod.getName() + "$$";
+  }
+
+  private String setFieldName(Property p) {
+    return p.setMethod.getName() + "$$";
+  }
+
+  private void createFields() {
+    FieldGen field;
+    // static Class _class;
+    field = new FieldGen(ACC_STATIC, new ObjectType("java.lang.Class"), "_class", _cp);
+    _cg.addField(field.getField());
+    // Adapter adapter;
+    field = new FieldGen(0, new ObjectType(adapterClass.getName()), adapterField, _cp);
+    _cg.addField(field.getField());
+    // getter and setter fields for each property
+    for (Property p : properties) {
+      field = new FieldGen(0, new ObjectType("dstm2.factory.Adapter$Getter"), getFieldName(p), _cp);
+      _cg.addField(field.getField());
+
+      field = new FieldGen(0, new ObjectType("dstm2.factory.Adapter$Setter"), setFieldName(p), _cp);
+      _cg.addField(field.getField());
+    }
+  }
+
+  private void initRegularField(Property p, InstructionList il, MethodGen method) {
+    InstructionHandle ih_0 = il.append(new PUSH(_cp, p._class.getName()));
+    il.append(InstructionFactory.createStore(Type.OBJECT, 1));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
+    il.append(_factory.createInvoke("java.lang.Class", "forName", new ObjectType("java.lang.Class"), new Type[]{Type.STRING}, Constants.INVOKESTATIC));
+    il.append(InstructionFactory.createStore(Type.OBJECT, 2));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, adapterField, new ObjectType(adapterClass.getName()), Constants.GETFIELD));
+    il.append(new PUSH(_cp, p.name));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 2));
+    il.append(_factory.createInvoke(adapterClass.getName(), "makeGetter", new ObjectType("dstm2.factory.Adapter$Getter"), new Type[]{Type.STRING, new ObjectType("java.lang.Class")}, Constants.INVOKEVIRTUAL));
+    il.append(_factory.createFieldAccess(className, getFieldName(p), new ObjectType("dstm2.factory.Adapter$Getter"), Constants.PUTFIELD));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, adapterField, new ObjectType(adapterClass.getName()), Constants.GETFIELD));
+    il.append(new PUSH(_cp, p.name));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 2));
+    il.append(_factory.createInvoke(adapterClass.getName(), "makeSetter", new ObjectType("dstm2.factory.Adapter$Setter"), new Type[]{Type.STRING, new ObjectType("java.lang.Class")}, Constants.INVOKEVIRTUAL));
+    InstructionHandle ih_33 = il.append(_factory.createFieldAccess(className, setFieldName(p), new ObjectType("dstm2.factory.Adapter$Setter"), Constants.PUTFIELD));
+    BranchInstruction goto_36 = InstructionFactory.createBranchInstruction(Constants.GOTO, null);
+    il.append(goto_36);
+    InstructionHandle ih_39 = il.append(InstructionFactory.createStore(Type.OBJECT, 1));
+    il.append(_factory.createNew("dstm2.exceptions.PanicException"));
+    il.append(InstructionConstants.DUP);
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
+    il.append(_factory.createInvoke("dstm2.exceptions.PanicException", "<init>", Type.VOID, new Type[]{new ObjectType("java.lang.Throwable")}, Constants.INVOKESPECIAL));
+    il.append(InstructionConstants.ATHROW);
+    InstructionHandle ih_49 = il.append(InstructionConstants.NOP);
+    goto_36.setTarget(ih_49);
+    method.addExceptionHandler(ih_0, ih_33, ih_39, new ObjectType("java.lang.ClassNotFoundException"));
+  }
+
+  private void initPrimitiveField(Property p, InstructionList il, MethodGen method) {
+    InstructionHandle ih_0 = il.append(new PUSH(_cp, p._class.getName()));
+    il.append(InstructionFactory.createStore(Type.OBJECT, 1));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
+    pushPrimitiveClass(il, p._class);
+    il.append(InstructionFactory.createStore(Type.OBJECT, 2));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, adapterField, new ObjectType(adapterClass.getName()), Constants.GETFIELD));
+    il.append(new PUSH(_cp, p.name));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 2));
+    il.append(_factory.createInvoke(adapterClass.getName(), "makeGetter", new ObjectType("dstm2.factory.Adapter$Getter"), new Type[]{Type.STRING, new ObjectType("java.lang.Class")}, Constants.INVOKEVIRTUAL));
+    il.append(_factory.createFieldAccess(className, getFieldName(p), new ObjectType("dstm2.factory.Adapter$Getter"), Constants.PUTFIELD));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, adapterField, new ObjectType(adapterClass.getName()), Constants.GETFIELD));
+    il.append(new PUSH(_cp, p.name));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 2));
+    il.append(_factory.createInvoke(adapterClass.getName(), "makeSetter", new ObjectType("dstm2.factory.Adapter$Setter"), new Type[]{Type.STRING, new ObjectType("java.lang.Class")}, Constants.INVOKEVIRTUAL));
+    InstructionHandle ih_33 = il.append(_factory.createFieldAccess(className, setFieldName(p), new ObjectType("dstm2.factory.Adapter$Setter"), Constants.PUTFIELD));
+    BranchInstruction goto_36 = InstructionFactory.createBranchInstruction(Constants.GOTO, null);
+    il.append(goto_36);
+    InstructionHandle ih_39 = il.append(InstructionFactory.createStore(Type.OBJECT, 1));
+    il.append(_factory.createNew("dstm2.exceptions.PanicException"));
+    il.append(InstructionConstants.DUP);
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
+    il.append(_factory.createInvoke("dstm2.exceptions.PanicException", "<init>", Type.VOID, new Type[]{new ObjectType("java.lang.Throwable")}, Constants.INVOKESPECIAL));
+    il.append(InstructionConstants.ATHROW);
+    InstructionHandle ih_49 = il.append(InstructionConstants.NOP);
+    goto_36.setTarget(ih_49);
+    method.addExceptionHandler(ih_0, ih_33, ih_39, new ObjectType("java.lang.ClassNotFoundException"));
+  }
+  // Create constructor
+  private void createCtor() {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[]{}, "<init>", className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createInvoke("java.lang.Object", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createNew(adapterClass.getName()));
+    il.append(InstructionConstants.DUP);
+    il.append(_factory.createFieldAccess(className, "_class", new ObjectType("java.lang.Class"), Constants.GETSTATIC));
+    il.append(_factory.createInvoke(adapterClass.getName(), "<init>", Type.VOID, new Type[]{new ObjectType("java.lang.Class")}, Constants.INVOKESPECIAL));
+    il.append(_factory.createFieldAccess(className, adapterField, new ObjectType(adapterClass.getName()), Constants.PUTFIELD));
+
+    for (Property p : properties) {
+      if (p._class.isPrimitive()) {
+        initPrimitiveField(p, il, method);
+      } else {
+        initRegularField(p, il, method);
+      }
+    }
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void createGetMethod(Property p) {
+    if (p._class.isPrimitive()) {
+      createPrimitiveGetMethod(p);
+    } else {
+      createRegularGetMethod(p);
+    }
+  }
+
+  private void createSetMethod(Property p) {
+    if (p._class.isPrimitive()) {
+      createPrimitiveSetMethod(p);
+    } else {
+      createRegularSetMethod(p);
+    }
+  }
+
+  private void createStatic() {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_STATIC, Type.VOID, Type.NO_ARGS, new String[]{}, "<clinit>", className, il, _cp);
+
+    InstructionHandle ih_0 = il.append(new PUSH(_cp, interfaceName));
+    il.append(_factory.createInvoke("java.lang.Class", "forName", new ObjectType("java.lang.Class"), new Type[]{Type.STRING}, Constants.INVOKESTATIC));
+    InstructionHandle ih_5 = il.append(_factory.createFieldAccess(className, "_class", new ObjectType("java.lang.Class"), Constants.PUTSTATIC));
+    BranchInstruction goto_8 = InstructionFactory.createBranchInstruction(Constants.GOTO, null);
+    il.append(goto_8);
+    InstructionHandle ih_11 = il.append(InstructionFactory.createStore(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createInvoke("java.lang.ClassNotFoundException", "printStackTrace", Type.VOID, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
+    InstructionHandle ih_16 = il.append(InstructionFactory.createReturn(Type.VOID));
+    goto_8.setTarget(ih_16);
+    method.addExceptionHandler(ih_0, ih_5, ih_11, new ObjectType("java.lang.ClassNotFoundException"));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void pushPrimitiveClass(InstructionList il, Class _class) {
+    il.append(_factory.createFieldAccess(unboxedClass(_class), "TYPE", new ObjectType("java.lang.Class"), Constants.GETSTATIC));
+  }
+
+  private String unboxedClass(Class _class) {
+    if (_class.equals(Boolean.TYPE)) {
+      return "java.lang.Boolean";
+    } else if (_class.equals(Character.TYPE)) {
+      return "java.lang.Character";
+    } else if (_class.equals(Byte.TYPE)) {
+      return "java.lang.Byte";
+    } else if (_class.equals(Short.TYPE)) {
+      return "java.lang.Short";
+    } else if (_class.equals(Integer.TYPE)) {
+      return "java.lang.Integer";
+    } else if (_class.equals(Long.TYPE)) {
+      return "java.lang.Long";
+    } else if (_class.equals(Float.TYPE)) {
+      return "java.lang.Float";
+    } else if (_class.equals(Double.TYPE)) {
+      return "java.lang.Double";
+    } else {
+      throw new PanicException("Unrecognized primitive type: " + _class);
+    }
+  }
+
+  private void createPrimitiveGetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_PUBLIC, p.type, Type.NO_ARGS, new String[]{}, p.getMethod.getName(), className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, getFieldName(p), new ObjectType("dstm2.factory.Adapter$Getter"), Constants.GETFIELD));
+    il.append(_factory.createInvoke("dstm2.factory.Adapter$Getter", "call", Type.OBJECT, Type.NO_ARGS, Constants.INVOKEINTERFACE));
+    il.append(_factory.createCheckCast(new ObjectType(unboxedClass(p._class))));
+    il.append(_factory.createInvoke(unboxedClass(p._class), p._class.getName() + "Value", p.type, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
+    il.append(InstructionFactory.createReturn(p.getMethod.getReturnType()));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void createPrimitiveSetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_PUBLIC, Type.VOID, new Type[]{p.type}, new String[]{"arg0"}, p.setMethod.getName(), className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, setFieldName(p), new ObjectType("dstm2.factory.Adapter$Setter"), Constants.GETFIELD));
+    il.append(InstructionFactory.createLoad(p.setMethod.getArgumentTypes()[0], 1));
+    il.append(_factory.createInvoke(unboxedClass(p._class), "valueOf", new ObjectType(unboxedClass(p._class)), new Type[]{p.type}, Constants.INVOKESTATIC));
+    il.append(_factory.createInvoke("dstm2.factory.Adapter$Setter", "call", Type.VOID, new Type[]{Type.OBJECT}, Constants.INVOKEINTERFACE));
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void createRegularGetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_PUBLIC, p.type, Type.NO_ARGS, new String[]{}, p.getMethod.getName(), className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, getFieldName(p), new ObjectType("dstm2.factory.Adapter$Getter"), Constants.GETFIELD));
+    il.append(_factory.createInvoke("dstm2.factory.Adapter$Getter", "call", Type.OBJECT, Type.NO_ARGS, Constants.INVOKEINTERFACE));
+    il.append(_factory.createCheckCast(new ObjectType(p._class.getName())));
+    il.append(InstructionFactory.createReturn(Type.OBJECT));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+
+  }
+
+  private void createRegularSetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_PUBLIC, Type.VOID, new Type[]{p.type}, new String[]{"arg0"}, p.setMethod.getName(), className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, setFieldName(p), new ObjectType("dstm2.factory.Adapter$Setter"), Constants.GETFIELD));
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
+    il.append(_factory.createInvoke("dstm2.factory.Adapter$Setter", "call", Type.VOID, new Type[]{Type.OBJECT}, Constants.INVOKEINTERFACE));
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void passThrough(Class c, Method m) {
+    InstructionList il = new InstructionList();
+    Type[] argTypes = m.getArgumentTypes();
+    String[] argNames = new String[m.getArgumentTypes().length];
+    int argCount = argTypes.length;
+    for (int i = 0; i < argCount; i++) {
+      argNames[i] = "arg" + i;
+    }
+    MethodGen method = new MethodGen(Constants.ACC_PUBLIC,
+        m.getReturnType(),
+        argTypes, argNames,
+        m.getName(), className, il, _cp);
+
+    il.append(_factory.createFieldAccess(className, adapterField, new ObjectType(adapterClass.getName()), Constants.GETFIELD));
+    il.append(_factory.createCheckCast(new ObjectType(c.getName())));
+    il.append(InstructionFactory.createStore(Type.OBJECT, argCount + 1));
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, argCount + 1));
+    for (int i = 0; i < argCount; i++) {
+      il.append(InstructionFactory.createLoad(argTypes[i], i + 1));
+    }
+    il.append(_factory.createInvoke(c.getName(),
+        m.getName(),
+        m.getReturnType(),
+        m.getArgumentTypes(),
+        Constants.INVOKEINTERFACE));
+    il.append(InstructionFactory.createReturn(m.getReturnType()));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/boosting/Adapter.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/boosting/Adapter.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/boosting/Adapter.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,106 @@
+/*
+ * Adapter.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.factory.boosting;
+
+import dstm2.exceptions.PanicException;
+import dstm2.factory.Factory;
+import dstm2.boosting.TwoPhase;
+import dstm2.factory.SequentialFactory;
+import dstm2.factory.shadow.Recoverable;
+import dstm2.factory.shadow.RecoverableFactory;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Simple boosting implementation.
+ * <b>Warning</b>
+ * Boosting works best when one can exploit object semantics.
+ * @param <T> type of object created
+ * @author Maurice Herlihy
+ */
+public class Adapter<T> implements dstm2.factory.Adapter<T> {
+
+  T version;
+  TwoPhase lock;
+  boolean firstTime;
+  private static Map<Class, Factory> map = new HashMap<Class, Factory>();
+
+  /**
+   * Creates a new instance of Adapter
+   * @param _class class of object created
+   */
+  public Adapter(Class<T> _class) {
+    lock = new TwoPhase();
+    Factory<T> factory = map.get(_class);
+    if (factory == null) {
+      factory = new SequentialFactory(_class);
+      map.put(_class, factory);
+    }
+    version = factory.create();
+    firstTime = true;
+  }
+
+  @Override
+  public <V> Adapter.Getter<V> makeGetter(String methodName, Class<V> _class) {
+    try {
+      final Method method = version.getClass().getMethod(methodName);
+      return new Adapter.Getter<V>() {
+        @Override
+        public V call() {
+          try {
+            lock.lock();
+            return (V) method.invoke(version);
+          } catch (IllegalArgumentException ex) {
+            throw new PanicException(ex);
+          } catch (IllegalAccessException ex) {
+            throw new PanicException(ex);
+          } catch (InvocationTargetException ex) {
+            throw new PanicException(ex);
+          }
+        }
+      };
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+  }
+
+  @Override
+  public <V> Adapter.Setter<V> makeSetter(String methodName, Class<V> _class) {
+    try {
+      final Method method = version.getClass().getMethod(methodName, _class);
+
+      return new Adapter.Setter<V>() {
+
+        @Override
+        public void call(V value) {
+          try {
+            lock.lock();
+            if (firstTime) {
+              ((Recoverable) version).backup();
+              firstTime = false;
+            }
+            method.invoke(version, value);
+          } catch (IllegalArgumentException ex) {
+            throw new PanicException(ex);
+          } catch (IllegalAccessException ex) {
+            throw new PanicException(ex);
+          } catch (InvocationTargetException ex) {
+            throw new PanicException(ex);
+          }
+        }
+      };
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+  }
+}
+

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/Adapter.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/Adapter.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/Adapter.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,283 @@
+/*
+ * Adapter.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.factory.ofree;
+
+import dstm2.ContentionManager;
+import dstm2.Transaction;
+import dstm2.exceptions.AbortedException;
+import dstm2.exceptions.PanicException;
+import dstm2.Thread;
+import dstm2.factory.Copyable;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Obstruction-free atomic object implementation. Visible reads.
+ * @param <T> Object type
+ * @author Maurice Herlihy
+ */
+public class Adapter<T> implements dstm2.factory.Adapter<T> {
+
+  protected Class<T> iface;
+  static Map<Class, CopyableFactory> factoryMap = new HashMap<Class, CopyableFactory>();
+  protected CopyableFactory<T> factory;
+  protected AtomicReference<Locator> start;
+  private static AbortedException abortedException = new AbortedException();
+
+  enum Mode {
+    WRITE, READ
+  };
+
+  /**
+   * Creates a new instance of Adapter
+   * @param myClass class implemented
+   */
+  @SuppressWarnings(value = "unchecked")
+  public Adapter(Class<T> myClass) {
+    iface = myClass;
+    factory = factoryMap.get(iface);
+    if (factory == null) {
+      factory = new CopyableFactory<T>(iface);
+      factoryMap.put(iface, factory);
+    }
+    Locator locator = new Locator(Transaction.COMMITTED, Mode.WRITE);
+    start = new AtomicReference<Locator>(locator);
+  }
+
+  @Override
+  public <V> Adapter.Setter<V> makeSetter(String methodName, Class<V> _class) {
+    try {
+      @SuppressWarnings(value = "unchecked")
+      T version = (T) start.get().newVersion;
+      final Method method = version.getClass().getMethod(methodName, _class);
+      final ContentionManager manager = Thread.getContentionManager();
+      return new Adapter.Setter<V>() {
+
+        @Override
+        @SuppressWarnings(value = "unchecked")
+        public void call(V value) {
+          try {
+            Transaction me = Thread.getTransaction();
+            Locator oldLocator = start.get();
+            T version = (T) oldLocator.fastPath(me);
+            if (version != null) {
+              method.invoke(version, value);
+              validate(me);
+              return;
+            }
+            Locator newLocator = new Locator(me, Mode.WRITE);
+            while (true) {
+              oldLocator = start.get();
+              newLocator.writePrepare(me, manager, oldLocator);
+              version = (T) newLocator.newVersion;
+              method.invoke(version, value);
+              if (start.compareAndSet(oldLocator, newLocator)) {
+                validate(me);
+                manager.openSucceeded();
+                return;
+              }
+              oldLocator = start.get();
+            }
+          } catch (IllegalAccessException e) {
+            throw new PanicException(e);
+          } catch (InvocationTargetException e) {
+            throw new PanicException(e);
+          }
+        }
+      };
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+  }
+
+  @Override
+  public <V> Adapter.Getter<V> makeGetter(String methodName, Class<V> _class) {
+    try {
+      @SuppressWarnings(value = "unchecked")
+      T version = (T) start.get().newVersion;
+      final Method method = version.getClass().getMethod(methodName);
+      final ContentionManager manager = Thread.getContentionManager();
+      return new Adapter.Getter<V>() {
+
+        @Override
+        @SuppressWarnings(value = "unchecked")
+        public V call() {
+          try {
+            Transaction me = Thread.getTransaction();
+            Locator oldLocator = start.get();
+            T version = (T) oldLocator.fastPath(me);
+            if (version != null) {
+              V result = (V) method.invoke(version);
+              validate(me);
+              return result;
+            }
+            Locator newLocator = new Locator(me, Mode.READ);
+            while (true) {
+              newLocator.readPrepare(me, manager, oldLocator);
+              version = (T) newLocator.newVersion;
+              V result = (V) method.invoke(version);
+              if (start.compareAndSet(oldLocator, newLocator)) {
+                validate(me);
+                manager.openSucceeded();
+                return result;
+              }
+              oldLocator = start.get();
+            }
+          } catch (IllegalAccessException e) {
+            throw new PanicException(e);
+          } catch (InvocationTargetException e) {
+            throw new PanicException(e);
+          }
+
+        }
+      };
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+
+  }
+
+  private static void validate(Transaction me) {
+    if (me != null && !me.isActive()) {
+      throw abortedException;
+    }
+  }
+
+  /**
+   * A locator points to an old version, a new version, and transactional
+   * bookkeeping information. A transaction opens an object by creating
+   * and installing a new locator.
+   */
+  public class Locator {
+
+    /**
+     * Transaction that last opened this object.
+     */
+    public final Transaction owner;
+    /**
+     * If open for reading, next transaction reading this object.
+     */
+    Locator nextReader;
+    /**
+     * Older version of object. Tentative it writer is active, meaningless
+     * if writer is committed, and otherwise the current value.
+     */
+    public volatile Copyable oldVersion;
+    /**
+     * Newer version of object. Tentative it writer is active, meaningless
+     * if writer is aborted, and otherwise the current value.
+     */
+    public volatile Copyable newVersion;
+    /**
+     * Does this locator repesent creation, reading, or writing?
+     */
+    Mode mode;
+//    Locator _prev;
+    /**
+     * Constructor
+     * @param me calling transaction
+     * @param myReadOnly read or write?
+     */
+    Locator(Transaction me, Mode myMode) {
+      owner = me;
+      mode = myMode;
+      switch (myMode) {
+        case READ:
+          oldVersion = newVersion = null;
+          return;
+        case WRITE:
+          oldVersion = null;
+          newVersion = (Copyable) factory.create();
+          return;
+      }
+    }
+
+    /**
+     * Checks whether object is already opened by caller.
+     * @param me calling transaction
+     * @return Returns version if already open, null otherwise.
+     */
+    public Copyable fastPath(Transaction me) {
+      if (me == null) {
+        return getVersion(null, null);
+      } else if (owner == me && !mode.equals(Mode.READ)) {
+        return newVersion;
+      } else {
+        return null;
+      }
+    }
+
+    public Copyable getVersion(Transaction me, ContentionManager manager) {
+      if (owner.equals(me)) {
+        return newVersion;
+      }
+      if (owner.isActive() && manager == null) {
+        throw new PanicException("Transactional/Non-Tranactional race");
+      }
+      while (owner.isActive()) {
+        manager.resolveConflict(me, owner);
+        validate(me);
+      }
+      switch (owner.getStatus()) {
+        case COMMITTED:
+          return newVersion;
+        case ABORTED:
+          return oldVersion;
+        default:
+          throw new PanicException("Unexpected transaction state: " + owner.getStatus());
+      }
+    }
+
+    public void readPrepare(Transaction me,
+        ContentionManager manager,
+        Locator oldLocator) {
+      switch (oldLocator.mode) {
+        case READ:
+          newVersion = oldVersion = oldLocator.getVersion(me, manager);
+          while (oldLocator != null && !oldLocator.owner.isActive()) {
+            oldLocator = oldLocator.nextReader;
+          }
+          nextReader = oldLocator;
+          return;
+        case WRITE:
+          newVersion = oldVersion = oldLocator.getVersion(me, manager);
+          Transaction t = oldLocator.owner;
+          if (t != null && t != me) {
+            while (t.isActive() && me.isActive()) {
+              manager.resolveConflict(me, t);
+            }
+          }
+          return;
+      }
+    }
+
+    public void writePrepare(Transaction me, ContentionManager manager, Locator oldLocator) {
+      retry:
+      while (true) {
+        oldVersion = oldLocator.getVersion(me, manager);
+        newVersion.copyFrom(oldVersion);
+        while (oldLocator != null) {
+          Transaction t = oldLocator.owner;
+          if (t != null && t.isActive() && t != me) {
+            manager.resolveConflict(me, t);
+            continue retry;
+          }
+
+          oldLocator = oldLocator.nextReader;
+        }
+
+        return;
+      }
+    }
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/CopyableFactory.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/CopyableFactory.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/CopyableFactory.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,144 @@
+/*
+ * CopyableFactory.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.factory.ofree;
+
+import dstm2.exceptions.PanicException;
+import dstm2.factory.BaseFactory;
+import dstm2.factory.Property;
+import org.apache.bcel.Constants;
+import org.apache.bcel.generic.*;
+
+/**
+ * @author Maurice Herlihy
+ */
+public class CopyableFactory<T> extends BaseFactory<T> {
+
+  /*
+   * CopyableFactory.java
+   *
+   * Created on November 21, 2005, 8:54 PM
+   */
+  public CopyableFactory(Class<T> myClass) {
+    super(myClass);
+    synchronized (lock) {
+      className = myClass.getName() + "$";
+      int constants = Constants.ACC_PUBLIC | Constants.ACC_SUPER;
+      String[] myInterfaces = new String[]{myClass.getName(), "dstm2.factory.Copyable"};
+      _cg = new ClassGen(className, "java.lang.Object", null, constants, myInterfaces);
+      _cp = _cg.getConstantPool();
+      _factory = new InstructionFactory(_cg, _cp);
+      createCtor();
+      for (Property p : properties) {
+        createField(p.type, p.name);
+        createGetMethod(p);
+        createSetMethod(p);
+      }
+      createCopyFrom();
+      seal();
+    }
+  }
+
+  /**
+   * Create an object.
+   * @return the object.
+   */
+  @Override
+  public T create() {
+    try {
+      return theClass.newInstance();
+    } catch (InstantiationException ex) {
+      throw new PanicException(ex);
+    } catch (IllegalAccessException ex) {
+      throw new PanicException(ex);
+    }
+  }
+
+  private void createCtor() {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[]{}, "<init>", className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createInvoke("java.lang.Object", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void createCopyFrom() {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, new Type[]{Type.OBJECT}, new String[]{"arg0"}, "copyFrom", className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 1));
+    il.append(_factory.createCheckCast(new ObjectType(className)));
+    il.append(InstructionFactory.createStore(Type.OBJECT, 2));
+    for (Property p : properties) {
+      il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+      il.append(InstructionFactory.createLoad(Type.OBJECT, 2));
+      il.append(_factory.createFieldAccess(className, p.name, p.type, Constants.GETFIELD));
+      il.append(_factory.createFieldAccess(className, p.name, p.type, Constants.PUTFIELD));
+    }
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void createGetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(Constants.ACC_PUBLIC, p.type, Type.NO_ARGS, new String[]{}, p.getMethod.getName(), className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, p.name, p.type, Constants.GETFIELD));
+    il.append(InstructionFactory.createReturn(p.type));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void createSetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, new Type[]{p.type}, new String[]{"value"}, p.setMethod.getName(), className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(p.type, 1));
+    il.append(_factory.createFieldAccess(className, p.name, p.type, Constants.PUTFIELD));
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/Locator.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/Locator.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/Locator.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,172 @@
+/*
+ * Locator.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.
+ *
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ *
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.
+ *
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.factory.ofree;
+
+import dstm2.exceptions.AbortedException;
+import dstm2.ContentionManager;
+import dstm2.exceptions.PanicException;
+import dstm2.Transaction.Status;
+import dstm2.Transaction;
+import dstm2.factory.Copyable;
+import java.util.concurrent.ConcurrentSkipListSet;
+
+/**
+ * A locator points to an old version, a new version, and transactional
+ * bookkeeping information. A transaction opens an object by creating
+ * and installing a new locator.
+ *
+ * @author Maurice Herlihy
+ */
+public class Locator {
+
+  /**
+   * Transaction that last opened this object for writing.
+   */
+  public final Transaction writer;
+  /**
+   * Set of transactions currently reading this object.
+   */
+  public final ConcurrentSkipListSet<Transaction> readers;
+  /**
+   * Prior version of object. Meaningless if last writer committed.
+   */
+  public volatile Copyable oldVersion;
+  /**
+   * Newer version of object. Tentative it writer is active, meaningless
+   * if writer is aborted, and otherwise the current value.
+   */
+  public volatile Copyable newVersion;
+  private static final int THRESHOLD = 32;
+
+  /**
+   * Creates a new instance of Locator
+   *
+   */
+  public Locator() {
+    writer = Transaction.COMMITTED;
+    readers = new ConcurrentSkipListSet<Transaction>();
+    oldVersion = null;
+    newVersion = null;
+  }
+
+  /**
+   * Open object for writing.
+   * @param me Calling transaction.
+   * @param version Version to be modified.
+   */
+  public Locator(Transaction me, Copyable version) {
+    writer = me;
+    readers = new ConcurrentSkipListSet<Transaction>();
+    oldVersion = null;
+    newVersion = version;
+  }
+
+  /**
+   * Checks whether object is alread opened (for writing).
+   * @param me calling transaction
+   * @return Returns version if already open, null otherwise.
+   */
+  public Copyable fastPath(Transaction me) {
+    if (me == null) {
+      return getVersion(null, null);
+    } else if (writer == me) {
+      return newVersion;
+    } else {
+      return null;
+    }
+  }
+
+  public Copyable getVersion(Transaction me, ContentionManager manager) {
+    while (true) {
+      if (me != null && me.getStatus() == Status.ABORTED) {
+        throw new AbortedException();
+      }
+      switch (writer.getStatus()) {
+        case ACTIVE:
+          if (manager == null) {
+            throw new PanicException("Transactional/Non-Tranactional race");
+          }
+          manager.resolveConflict(me, writer);
+          continue;
+        case COMMITTED:
+          return newVersion;
+        case ABORTED:
+          return oldVersion;
+        default:
+          throw new PanicException("Unexpected transaction state: " + writer.getStatus());
+      }
+    }
+  }
+
+  /**
+   * Prepare a new locator to be used to open object for reading.
+   * @param me calling transaction
+   * @param manager caller's contention manager
+   * @param newLocator Prepare this locator for reading the object.
+   */
+  public void readPath(Transaction me, ContentionManager manager, Locator newLocator) {
+    Copyable version = getVersion(me, manager);
+    newLocator.oldVersion = newLocator.newVersion = version;
+    newLocator.readers.clear();
+    newLocator.readers.addAll(readers);
+    newLocator.readers.add(me);
+    if (me.isAborted()) {
+      throw new AbortedException();
+    }
+    return;
+  }
+
+  /**
+   * Prepare a new locator to be used to open object for writing.
+   * @param me caller
+   * @param manager caller's contention manager
+   * @param newLocator locator to prepare
+   */
+  public void writePath(Transaction me, ContentionManager manager, Locator newLocator) {
+    retry:
+    while (true) {
+      Copyable version = getVersion(me, manager);
+      newLocator.oldVersion = version;
+      newLocator.newVersion.copyFrom(version);
+      for (Transaction t : readers) {
+        if (t.isActive() && t != me) {
+          manager.resolveConflict(me, t);
+          continue retry;
+        }
+      }
+      if (me.isAborted()) {
+        throw new AbortedException();
+      }
+      return;
+    }
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/ReadSet.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/ReadSet.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/ReadSet.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,86 @@
+/*
+ * ReadSet.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.
+ *
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ *
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.
+ *
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.factory.ofree;
+
+import dstm2.Transaction;
+import java.util.ArrayList;
+import java.util.ListIterator;
+
+/**
+ * ReadSet.java
+ * Keep track of transactions that opened this object for READ.
+ *
+ * @author Maurice Herlihy
+ */
+public class ReadSet extends ArrayList<Transaction> {
+  
+  /**
+   * This value is public to facilitate unit testing.
+   */
+  public static final int INITIAL_SIZE = 32;
+  
+  int clean = INITIAL_SIZE / 2;
+  
+  public ReadSet() {
+    super(INITIAL_SIZE);
+  }
+  /**
+   * Create ReadSet of indicated size.
+   * @param size Size of readSet to create.
+   */
+  public ReadSet(int size) {
+    super(size);
+  }
+  
+  /**
+   * Add a new transaction to the set.
+   * @param t Transaction to add.
+   * @return Whether this transaction was already present.
+   */
+  @Override
+  public boolean add(Transaction t) {
+    if(--clean == 0) {
+      ListIterator<Transaction> iterator = listIterator();
+      while (iterator.hasNext()) {
+        Transaction tt = iterator.next();
+        if (!tt.isActive()) {
+          iterator.remove();
+        }
+      }
+      clean = size() / 2;
+    }
+    super.add(t);
+    return true;
+  }
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/XAdapter.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/XAdapter.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/ofree/XAdapter.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,283 @@
+/*
+ * Adapter.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.factory.ofree;
+
+import dstm2.ContentionManager;
+import dstm2.Transaction;
+import dstm2.exceptions.AbortedException;
+import dstm2.exceptions.PanicException;
+import dstm2.Thread;
+import dstm2.factory.Copyable;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Obstruction-free atomic object implementation. Visible reads.
+ * @param <T> Object type
+ * @author Maurice Herlihy
+ */
+public class XAdapter<T> implements dstm2.factory.Adapter<T> {
+
+  protected Class<T> iface;
+  static Map<Class, CopyableFactory> factoryMap = new HashMap<Class, CopyableFactory>();
+  protected CopyableFactory<T> factory;
+  protected AtomicReference<Locator> start;
+  private static AbortedException abortedException = new AbortedException();
+
+  enum Mode {
+    WRITE, READ
+  };
+
+  /**
+   * Creates a new instance of Adapter
+   * @param myClass class implemented
+   */
+  @SuppressWarnings(value = "unchecked")
+  public XAdapter(Class<T> myClass) {
+    iface = myClass;
+    factory = factoryMap.get(iface);
+    if (factory == null) {
+      factory = new CopyableFactory<T>(iface);
+      factoryMap.put(iface, factory);
+    }
+    Locator locator = new Locator(Transaction.COMMITTED, Mode.WRITE);
+    start = new AtomicReference<Locator>(locator);
+  }
+
+  @Override
+  public <V> Adapter.Setter<V> makeSetter(String methodName, Class<V> _class) {
+    try {
+      @SuppressWarnings(value = "unchecked")
+      T version = (T) start.get().newVersion;
+      final Method method = version.getClass().getMethod(methodName, _class);
+      final ContentionManager manager = Thread.getContentionManager();
+      return new Adapter.Setter<V>() {
+
+        @Override
+        @SuppressWarnings(value = "unchecked")
+        public void call(V value) {
+          try {
+            Transaction me = Thread.getTransaction();
+            Locator oldLocator = start.get();
+            T version = (T) oldLocator.fastPath(me);
+            if (version != null) {
+              method.invoke(version, value);
+              validate(me);
+              return;
+            }
+            Locator newLocator = new Locator(me, Mode.WRITE);
+            while (true) {
+              oldLocator = start.get();
+              newLocator.writePrepare(me, manager, oldLocator);
+              version = (T) newLocator.newVersion;
+              method.invoke(version, value);
+              if (start.compareAndSet(oldLocator, newLocator)) {
+                validate(me);
+                manager.openSucceeded();
+                return;
+              }
+              oldLocator = start.get();
+            }
+          } catch (IllegalAccessException e) {
+            throw new PanicException(e);
+          } catch (InvocationTargetException e) {
+            throw new PanicException(e);
+          }
+        }
+      };
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+  }
+
+  @Override
+  public <V> Adapter.Getter<V> makeGetter(String methodName, Class<V> _class) {
+    try {
+      @SuppressWarnings(value = "unchecked")
+      T version = (T) start.get().newVersion;
+      final Method method = version.getClass().getMethod(methodName);
+      final ContentionManager manager = Thread.getContentionManager();
+      return new Adapter.Getter<V>() {
+
+        @Override
+        @SuppressWarnings(value = "unchecked")
+        public V call() {
+          try {
+            Transaction me = Thread.getTransaction();
+            Locator oldLocator = start.get();
+            T version = (T) oldLocator.fastPath(me);
+            if (version != null) {
+              V result = (V) method.invoke(version);
+              validate(me);
+              return result;
+            }
+            Locator newLocator = new Locator(me, Mode.READ);
+            while (true) {
+              newLocator.readPrepare(me, manager, oldLocator);
+              version = (T) newLocator.newVersion;
+              V result = (V) method.invoke(version);
+              if (start.compareAndSet(oldLocator, newLocator)) {
+                validate(me);
+                manager.openSucceeded();
+                return result;
+              }
+              oldLocator = start.get();
+            }
+          } catch (IllegalAccessException e) {
+            throw new PanicException(e);
+          } catch (InvocationTargetException e) {
+            throw new PanicException(e);
+          }
+
+        }
+      };
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+
+  }
+
+  private static void validate(Transaction me) {
+    if (me != null && !me.isActive()) {
+      throw abortedException;
+    }
+  }
+
+  /**
+   * A locator points to an old version, a new version, and transactional
+   * bookkeeping information. A transaction opens an object by creating
+   * and installing a new locator.
+   */
+  public class Locator {
+
+    /**
+     * Transaction that last opened this object.
+     */
+    public final Transaction owner;
+    /**
+     * If open for reading, next transaction reading this object.
+     */
+    Locator nextReader;
+    /**
+     * Older version of object. Tentative it writer is active, meaningless
+     * if writer is committed, and otherwise the current value.
+     */
+    public volatile Copyable oldVersion;
+    /**
+     * Newer version of object. Tentative it writer is active, meaningless
+     * if writer is aborted, and otherwise the current value.
+     */
+    public volatile Copyable newVersion;
+    /**
+     * Does this locator repesent creation, reading, or writing?
+     */
+    Mode mode;
+//    Locator _prev;
+    /**
+     * Constructor
+     * @param me calling transaction
+     * @param myReadOnly read or write?
+     */
+    Locator(Transaction me, Mode myMode) {
+      owner = me;
+      mode = myMode;
+      switch (myMode) {
+        case READ:
+          oldVersion = newVersion = null;
+          return;
+        case WRITE:
+          oldVersion = null;
+          newVersion = (Copyable) factory.create();
+          return;
+      }
+    }
+
+    /**
+     * Checks whether object is already opened by caller.
+     * @param me calling transaction
+     * @return Returns version if already open, null otherwise.
+     */
+    public Copyable fastPath(Transaction me) {
+      if (me == null) {
+        return getVersion(null, null);
+      } else if (owner == me && !mode.equals(Mode.READ)) {
+        return newVersion;
+      } else {
+        return null;
+      }
+    }
+
+    public Copyable getVersion(Transaction me, ContentionManager manager) {
+      if (owner.equals(me)) {
+        return newVersion;
+      }
+      if (owner.isActive() && manager == null) {
+        throw new PanicException("Transactional/Non-Tranactional race");
+      }
+      while (owner.isActive()) {
+        manager.resolveConflict(me, owner);
+        validate(me);
+      }
+      switch (owner.getStatus()) {
+        case COMMITTED:
+          return newVersion;
+        case ABORTED:
+          return oldVersion;
+        default:
+          throw new PanicException("Unexpected transaction state: " + owner.getStatus());
+      }
+    }
+
+    public void readPrepare(Transaction me,
+        ContentionManager manager,
+        Locator oldLocator) {
+      switch (oldLocator.mode) {
+        case READ:
+          newVersion = oldVersion = oldLocator.getVersion(me, manager);
+          while (oldLocator != null && !oldLocator.owner.isActive()) {
+            oldLocator = oldLocator.nextReader;
+          }
+          nextReader = oldLocator;
+          return;
+        case WRITE:
+          newVersion = oldVersion = oldLocator.getVersion(me, manager);
+          Transaction t = oldLocator.owner;
+          if (t != null && t != me) {
+            while (t.isActive() && me.isActive()) {
+              manager.resolveConflict(me, t);
+            }
+          }
+          return;
+      }
+    }
+
+    public void writePrepare(Transaction me, ContentionManager manager, Locator oldLocator) {
+      retry:
+      while (true) {
+        oldVersion = oldLocator.getVersion(me, manager);
+        newVersion.copyFrom(oldVersion);
+        while (oldLocator != null) {
+          Transaction t = oldLocator.owner;
+          if (t != null && t.isActive() && t != me) {
+            manager.resolveConflict(me, t);
+            continue retry;
+          }
+
+          oldLocator = oldLocator.nextReader;
+        }
+
+        return;
+      }
+    }
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/recycle/Adapter.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/recycle/Adapter.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/recycle/Adapter.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,370 @@
+/*
+ * Adapter.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.
+ *
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ *
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.
+ *
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.factory.recycle;
+
+import dstm2.ContentionManager;
+import dstm2.Transaction;
+import dstm2.exceptions.AbortedException;
+import dstm2.exceptions.PanicException;
+import dstm2.Thread;
+import dstm2.factory.Copyable;
+import dstm2.factory.ofree.CopyableFactory;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicStampedReference;
+
+/**
+ * Obstruction-free atomic object implementation. Visible reads.
+ * @param <T> type created
+ * @author Maurice Herlihy
+ */
+public class Adapter<T> implements dstm2.factory.Adapter<T> {
+
+  protected Class<T> iface;
+  static Map<Class, CopyableFactory> factoryMap = new HashMap<Class, CopyableFactory>();
+  protected CopyableFactory<T> factory;
+  protected AtomicStampedReference<Locator> start;
+  private static AbortedException abortedException = new AbortedException();
+  static ThreadLocal<Locator> locatorPool = new ThreadLocal<Locator>() {
+
+    @Override
+    protected synchronized Locator initialValue() {
+      return null;
+    }
+  };
+
+  enum Mode {
+    WRITE, READ
+  };
+
+  /**
+   * Creates a new instance of Adapter
+   * @param myClass class to create
+   */
+  @SuppressWarnings(value = "unchecked")
+  public Adapter(Class<T> myClass) {
+    iface = myClass;
+    factory = factoryMap.get(iface);
+    if (factory == null) {
+      factory = new CopyableFactory<T>(iface);
+      factoryMap.put(iface, factory);
+    }
+    Locator locator = new Locator(Transaction.COMMITTED, (Copyable) factory.create());
+    start = new AtomicStampedReference<Locator>(locator, 0);
+  }
+
+  @Override
+  public <V> Adapter.Setter<V> makeSetter(String methodName, Class<V> _class) {
+    try {
+      @SuppressWarnings(value = "unchecked")
+      final int[] stamp = {0};
+      T version = (T) start.get(stamp).newVersion;
+      final Method method = version.getClass().getMethod(methodName, _class);
+      final ContentionManager manager = Thread.getContentionManager();
+      return new Adapter.Setter<V>() {
+
+        @Override
+        @SuppressWarnings(value = "unchecked")
+        public void call(V value) {
+          try {
+            Transaction me = Thread.getTransaction();
+            Locator oldLocator = start.get(stamp);
+            T version = (T) oldLocator.fastPath(me);
+            if (version != null) {
+              method.invoke(version, value);
+              validate(me);
+              return;
+            }
+            Locator newLocator = newLocator(me, (Copyable) factory.create());
+            while (true) {
+              oldLocator = start.get(stamp);
+              newLocator.writePrepare(me, manager, oldLocator);
+              int oldStamp = stamp[0];
+              if (start.get(stamp) == oldLocator && oldStamp == stamp[0]) {
+                version = (T) newLocator.newVersion;
+                method.invoke(version, value);
+                if (start.compareAndSet(oldLocator, newLocator,
+                    stamp[0], stamp[0] + 1)) {
+                  validate(me);
+                  manager.openSucceeded();
+                  return;
+                }
+                oldLocator = start.get(stamp);
+              }
+            }
+          } catch (IllegalAccessException e) {
+            throw new PanicException(e);
+          } catch (InvocationTargetException e) {
+            throw new PanicException(e);
+          }
+        }
+      };
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+  }
+
+  @Override
+  public <V> Adapter.Getter<V> makeGetter(String methodName, Class<V> _class) {
+    try {
+      @SuppressWarnings(value = "unchecked")
+      final int stamp[] = {0};
+      T version = (T) start.get(stamp).newVersion;
+      final Method method = version.getClass().getMethod(methodName);
+      final ContentionManager manager = Thread.getContentionManager();
+      return new Adapter.Getter<V>() {
+
+        @Override
+        @SuppressWarnings(value = "unchecked")
+        public V call() {
+          try {
+            Transaction me = Thread.getTransaction();
+            Locator oldLocator = start.get(stamp);
+            T version = (T) oldLocator.fastPath(me);
+            if (version != null) {
+              V result = (V) method.invoke(version);
+              validate(me);
+              return result;
+            }
+            Locator newLocator = newLocator(me);
+            while (true) {
+              newLocator.readPrepare(me, manager, oldLocator);
+              int oldStamp = stamp[0];
+              if (start.get(stamp) == oldLocator && oldStamp == stamp[0]) {
+                version = (T) newLocator.newVersion;
+                V result = (V) method.invoke(version);
+                if (start.compareAndSet(oldLocator, newLocator,
+                    stamp[0], stamp[0] + 1)) {
+                  validate(me);
+                  manager.openSucceeded();
+                  return result;
+                }
+              }
+              oldLocator = start.get(stamp);
+            }
+          } catch (IllegalAccessException e) {
+            throw new PanicException(e);
+          } catch (InvocationTargetException e) {
+            throw new PanicException(e);
+          }
+
+        }
+      };
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+
+  }
+
+  private static void validate(Transaction me) {
+    if (me != null && !me.isActive()) {
+      throw abortedException;
+    }
+  }
+
+  Locator newLocator(Transaction me) {
+    Locator locator = locatorPool.get();
+    if (locator == null) {
+      return new Locator(me);
+    } else {
+      locatorPool.set(locator.nextFree);
+      locator.init(me);
+      return locator;
+    }
+  }
+
+  Locator newLocator(Transaction me, Copyable version) {
+    Locator locator = locatorPool.get();
+    if (locator == null) {
+      return new Locator(me, version);
+    } else {
+      locatorPool.set(locator.nextFree);
+      locator.init(me, version);
+      return locator;
+    }
+  }
+
+  void freeLocator(Locator locator) {
+    locator.nextFree = locatorPool.get();
+    locatorPool.set(locator);
+  }
+
+  /**
+   * A locator points to an old version, a new version, and transactional
+   * bookkeeping information. A transaction opens an object by creating
+   * and installing a new locator.
+   */
+  public static class Locator {
+
+    /**
+     * Transaction that last opened this object.
+     */
+    public Transaction owner;
+    /**
+     * If open for reading, next transaction reading this object.
+     */
+    Locator nextReader;
+    /**
+     * Older version of object. Tentative it writer is active, meaningless
+     * if writer is committed, and otherwise the current value.
+     */
+    public volatile Copyable oldVersion;
+    /**
+     * Newer version of object. Tentative it writer is active, meaningless
+     * if writer is aborted, and otherwise the current value.
+     */
+    public volatile Copyable newVersion;
+    /**
+     * Does this locator repesent creation, reading, or writing?
+     */
+    Mode mode;
+    Locator nextFree;
+
+    /**
+     * Constructor
+     * @param me calling transaction
+     * @param myReadOnly read or write?
+     */
+    Locator(Transaction me, Copyable version) {
+      owner = me;
+      mode = Mode.WRITE;
+      oldVersion = null;
+      newVersion = version;
+      return;
+    }
+
+    /**
+     * Constructor
+     * @param me calling transaction
+     * @param myReadOnly read or write?
+     */
+    Locator(Transaction me) {
+      owner = me;
+      mode = Mode.READ;
+      oldVersion = newVersion = null;
+    }
+
+    void init(Transaction me) {
+      owner = me;
+      mode = Mode.READ;
+      oldVersion = newVersion = null;
+    }
+
+    void init(Transaction me, Copyable version) {
+      owner = me;
+      mode = Mode.WRITE;
+      oldVersion = null;
+      newVersion = version;
+      return;
+    }
+
+    /**
+     * Checks whether object is already opened by caller.
+     * @param me calling transaction
+     * @return Returns version if already open, null otherwise.
+     */
+    public Copyable fastPath(Transaction me) {
+      if (me == null) {
+        return getVersion(null, null);
+      } else if (owner == me && !mode.equals(Mode.READ)) {
+        return newVersion;
+      } else {
+        return null;
+      }
+    }
+
+    public Copyable getVersion(Transaction me, ContentionManager manager) {
+      if (owner.equals(me)) {
+        return newVersion;
+      }
+      if (owner.isActive() && manager == null) {
+        throw new PanicException("Transactional/Non-Tranactional race");
+      }
+      while (owner.isActive()) {
+        manager.resolveConflict(me, owner);
+        validate(me);
+      }
+      switch (owner.getStatus()) {
+        case COMMITTED:
+          return newVersion;
+        case ABORTED:
+          return oldVersion;
+        default:
+          throw new PanicException("Unexpected transaction state: " + owner.getStatus());
+      }
+    }
+
+    public void readPrepare(Transaction me,
+        ContentionManager manager,
+        Locator oldLocator) {
+      switch (oldLocator.mode) {
+        case READ:
+          newVersion = oldVersion = oldLocator.getVersion(me, manager);
+          while (oldLocator != null && !oldLocator.owner.isActive()) {
+            oldLocator = oldLocator.nextReader;
+          }
+          nextReader = oldLocator;
+          return;
+        case WRITE:
+          newVersion = oldVersion = oldLocator.getVersion(me, manager);
+          Transaction t = oldLocator.owner;
+          if (t != null && t != me) {
+            while (t.isActive() && me.isActive()) {
+              manager.resolveConflict(me, t);
+            }
+          }
+          return;
+      }
+    }
+
+    public void writePrepare(Transaction me, ContentionManager manager, Locator oldLocator) {
+      retry:
+      while (true) {
+        oldVersion = oldLocator.getVersion(me, manager);
+        newVersion.copyFrom(oldVersion);
+        while (oldLocator != null) {
+          Transaction t = oldLocator.owner;
+          if (t != null && t.isActive() && t != me) {
+            manager.resolveConflict(me, t);
+            continue retry;
+          }
+
+          oldLocator = oldLocator.nextReader;
+        }
+
+        return;
+      }
+    }
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/Adapter.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/Adapter.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/Adapter.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,238 @@
+/*
+ * Adapter.java
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.factory.shadow;
+
+import dstm2.ContentionManager;
+import dstm2.Transaction;
+import dstm2.exceptions.AbortedException;
+import dstm2.exceptions.PanicException;
+import dstm2.Thread;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Shadow-field atomic object implementation. Visible reads.
+ * @param <T> object type
+ * @author Maurice Herlihy
+ */
+public class Adapter<T> implements dstm2.factory.Adapter<T> {
+
+  Class<T> iface;
+  T version;
+  Recoverable rVersion;
+  ContentionManager manager;
+  Transaction writer;
+  ReadSet readers;
+  private final static String FORMAT = "Unexpected transaction state: %s";
+  static Map<Class, RecoverableFactory> factoryMap = new HashMap<Class, RecoverableFactory>();
+  /**
+   * A transaction switches to exclusive mode after being aborted this many times.
+   */
+  public static final int CONFLICT_THRESHOLD = 8;
+
+  /**
+   * Creates a new instance of Adapter
+   * @param _class object run-time class
+   */
+  public Adapter(Class<T> _class) {
+    iface = _class;
+    @SuppressWarnings("unchecked")
+    RecoverableFactory<T> factory = factoryMap.get(iface);
+    if (factory == null) {
+      factory = new RecoverableFactory<T>(iface);
+      factoryMap.put(iface, factory);
+    }
+    version = factory.create();
+    rVersion = (Recoverable) version;
+    manager = Thread.getContentionManager();
+    writer = Transaction.COMMITTED;
+    readers = new ReadSet();
+  }
+
+  @Override
+  public <V> Adapter.Setter<V> makeSetter(String methodName, Class<V> _class) {
+    try {
+      final Method method = version.getClass().getMethod(methodName, _class);
+      return new Adapter.Setter<V>() {
+
+        @Override
+        public void call(V value) {
+          try {
+            Transaction me = Thread.getTransaction();
+            Transaction other = null;
+            List<Transaction> others = null;
+            while (true) {
+              synchronized (Adapter.this) {
+                others = readWriteConflict(me);
+                if (others == null) {
+                  other = openWrite(me);
+                  if (other == null) {
+                    method.invoke(version, value);
+                    return;
+                  }
+                }
+              }
+              if (others != null) {
+                manager.resolveConflict(me, others);
+              } else if (other != null) {
+                manager.resolveConflict(me, other);
+              }
+            }
+          } catch (IllegalAccessException e) {
+            throw new PanicException(e);
+          } catch (InvocationTargetException e) {
+            throw new PanicException(e);
+          }
+        }
+      };
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+  }
+
+  @Override
+  public <V> Adapter.Getter<V> makeGetter(String methodName, Class<V> _class) {
+    try {
+      final Method method = version.getClass().getMethod(methodName);
+      return new Adapter.Getter<V>() {
+
+        @Override
+        public V call() {
+          try {
+            Transaction me = Thread.getTransaction();
+            Transaction other = null;
+            int debug = 0;
+            while (true) {
+              debug++;
+              if (debug > 100) {
+                int xxx = 1;
+              }
+              synchronized (Adapter.this) {
+ //               other = openWrite(me);
+                other = openRead(me);
+                if (other == null) {
+                  return (V) method.invoke(version);
+                }
+              }
+              manager.resolveConflict(me, other);
+            }
+          } catch (SecurityException e) {
+            throw new PanicException(e);
+          } catch (IllegalAccessException e) {
+            throw new PanicException(e);
+          } catch (InvocationTargetException e) {
+            throw new PanicException(e);
+          }
+        }
+      };
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+  }
+
+  /**
+   * Tries to open object for reading.
+   ** @param me calling transaction
+   * @return conflicting transaction or <code>null</code>
+   */
+  public Transaction openRead(Transaction me) {
+    if (me == null) {	// restore object if latest writer aborted
+      if (writer.isAborted()) {
+        rVersion.recover();
+        writer = Transaction.COMMITTED;
+      }
+      return null;
+    }
+//    // don't try read sharing if contention seems high
+//    if (me.attempts > CONFLICT_THRESHOLD) {
+//      return openWrite(me);
+//    }
+    // Am I still active?
+    if (!me.isActive()) {
+      throw new AbortedException();
+    }
+    // Already open for write?
+    if (writer == me) {
+      return null;
+    }
+    switch (writer.getStatus()) {
+      case ACTIVE:
+        return writer;
+      case COMMITTED:
+        break;
+      case ABORTED:
+        rVersion.recover();
+        break;
+      default:
+        throw new PanicException(FORMAT, writer.getStatus());
+    }
+    writer = Transaction.COMMITTED;
+    readers.add(me);
+    manager.openSucceeded();
+    return null;
+  }
+
+  /**
+   * Tries to open object for reading.
+   * Returns reference to conflicting transaction, if one exists
+   **/
+  Transaction openWrite(Transaction me) {
+    // not in a transaction
+    if (me == null) {
+      // restore object if latest writer aborted
+      if (writer.isAborted()) {
+        rVersion.recover();
+        writer = Transaction.COMMITTED;
+      }
+      return null;
+    }
+    if (!me.isActive()) {
+      throw new AbortedException();
+    }
+    if (me == writer) {
+      return null;
+    }
+    switch (writer.getStatus()) {
+      case ACTIVE:
+        return writer;
+      case COMMITTED:
+        rVersion.backup();
+        break;
+      case ABORTED:
+        rVersion.recover();
+        break;
+      default:
+        throw new PanicException(FORMAT, writer.getStatus());
+    }
+    writer = me;
+    me.memRefs++;
+    manager.openSucceeded();
+    return null;
+  }
+
+  /**
+   *
+   * @param me calling transaction
+   * @return
+   */
+  public List<Transaction> readWriteConflict(Transaction me) {
+    for (Transaction reader : readers) {
+      if (reader.isActive() && reader != me) {
+        return readers;
+      }
+    }
+    readers.clear();
+    return null;
+  }
+}
+

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/ReadSet.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/ReadSet.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/ReadSet.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,202 @@
+/*
+ * ReadSet.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.factory.shadow;
+
+import dstm2.Transaction;
+import java.util.AbstractList;
+
+class ReadSet extends AbstractList<Transaction> {
+  
+  /**
+   * This value is public to facilitate unit testing.
+   */
+  final static int INITIAL_SIZE = 64;
+  /**
+   * Number of allocated slots. Must reallocate if actual number of
+   * transactions exceeds this size.
+   */
+  private int size;
+  /**
+   * Next free slot in array.
+   */
+  private int next;
+  /**
+   * Iterates over elements.
+   */
+  private Transaction elements[];
+  
+  /**
+   * Create ReadSet of default size.
+   */
+  public ReadSet() {
+    this(INITIAL_SIZE);
+  }
+  /**
+   * Create ReadSet of indicated size.
+   * @param size Size of readSet to create.
+   */
+  public ReadSet(int size) {
+    this.size = size;
+    elements = new Transaction[size];
+    next = 0;
+  }
+  
+  /**
+   * Initialize one object from another.
+   * @param aSet Initialize from this other object.
+   */
+  public void copyFrom(ReadSet aSet) {
+    if (aSet.size > this.size) {
+      elements = new Transaction[aSet.size];
+      this.size = aSet.size;
+    }
+    System.arraycopy(aSet.elements, 0, this.elements, 0, aSet.next);
+    this.next = aSet.next;
+  }
+  
+  /**
+   * Add a new transaction to the set.
+   * @param t Transaction to add.
+   * @return Whether this transaction was already present.
+   */
+  public boolean add(Transaction t) {
+    // try to reuse slot
+    for (int i = 0; i < next; i++) {
+      if (!elements[i].isActive()) {
+        elements[i] = t;
+        return true;
+      } else if (elements[i] == t) {
+        return true;
+      }
+    }
+    // check for overflow
+    if (next == size) {
+      Transaction[] newElements = new Transaction[2 * size];
+      System.arraycopy(elements, 0, newElements, 0, size);
+      elements = newElements;
+      size = 2 * size;
+    }
+    elements[next++] = t;
+    return true;
+  }
+  
+  /**
+   * remove transaction from the set.
+   * @param t Transaction to remove.
+   * @return Whether this transaction was already present.
+   */
+  public boolean remove(Transaction t) {
+    // try to reuse slot
+    int i = 0;
+    boolean present = false;
+    while(i < next) {
+      if (elements[i] == t) {
+        elements[i] = elements[next--];
+        present = true;
+      } else {
+        i++;
+      }
+    }
+    return present;
+  }
+  
+  /**
+   * Discard all elements of this set.
+   */
+  public void clear() {
+    next = 0;
+  }
+  
+  /**
+   * discard inactive transactions
+   * must be called only while object is locked!
+   **/
+//  public void clean() {
+//    int i = 0;
+//    while (i < next && (!elements[i].isActive())) {
+//      elements[i] = elements[next-1];
+//      next--;
+//    }
+//  }
+  /**
+   * How many transactions in the set?
+   * @return Number of transactions in the set.
+   */
+  public int size() {
+    return next;
+  }
+  
+  /**
+   * Iterate over transaction in the set.
+   * @return Iterator over transactions in the set.
+   */
+  public java.util.Iterator<Transaction> iterator() {
+    return new Iterator();
+  }
+  
+  /**
+   * Inner class that implements iterator.
+   */
+  private class Iterator implements java.util.Iterator<Transaction> {
+    /**
+     * Iterator position.
+     */
+    int pos = 0;
+    /**
+     * Is there another item in the set?
+     * @return whether there are more active transactions
+     */
+    public boolean hasNext() {
+      return pos < next;
+    }
+    
+    /**
+     * Get next item in the set.
+     * @return Next item in the set.
+     */
+    public Transaction next() {
+      return ReadSet.this.elements[pos++];
+    }
+    
+    /**
+     * Do not call this method.
+     */
+    public void remove() {
+      throw new java.lang.UnsupportedOperationException();
+    }
+  }
+
+    public Transaction get(int index) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/Recoverable.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/Recoverable.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/Recoverable.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,49 @@
+/*
+ * Recoverable.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.factory.shadow;
+
+/**
+ * Interface for recoverable objects.
+ * @author Maurice Herlihy
+ */
+public interface Recoverable {
+  /**
+   * Copy fields to shadow fiels.
+   **/
+  void backup();
+  /**
+   * Copy shadow fields to fields.
+   **/
+  void recover();
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/RecoverableFactory.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/RecoverableFactory.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/RecoverableFactory.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,158 @@
+/*
+ * RecoverableFactory.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.factory.shadow;
+
+import dstm2.exceptions.PanicException;
+import dstm2.factory.BaseFactory;
+import dstm2.factory.Property;
+import org.apache.bcel.Constants;
+import org.apache.bcel.generic.*;
+
+import static org.apache.bcel.Constants.*;
+
+/**
+ * Implements simple object with getters and setters. Also provides a
+ * <code>copyTo</code> method that copies one such object to another.
+ * @author Maurice Herlihy
+ */
+public class RecoverableFactory<T> extends BaseFactory<T> {
+
+  public RecoverableFactory(Class<T> _class) {
+    super(_class);
+    synchronized (lock) {
+      className = _class.getName() + "$";
+      int constants = Constants.ACC_PUBLIC | Constants.ACC_SUPER;
+      String[] myInterfaces = new String[]{_class.getName(), "dstm2.factory.shadow.Recoverable"};
+      _cg = new ClassGen(className, "java.lang.Object", null, constants, myInterfaces);
+      _cp = _cg.getConstantPool();
+      _factory = new InstructionFactory(_cg, _cp);
+      createCtor();
+      for (Property p : properties) {
+        createField(p.type, p.name);        // actual field
+        createField(p.type, p.name + "$");  // shadow field
+        createGetMethod(p);
+        createSetMethod(p);
+      }
+      createBackup();
+      createRecover();
+      seal();
+    }
+  }
+
+  /**
+   * Create an object.
+   * @return the object.
+   */
+  @Override
+  public T create() {
+    try {
+      return theClass.newInstance();
+    } catch (Exception ex) {
+      throw new PanicException(ex);
+    }
+  }
+
+  private void createCtor() {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[]{}, "<init>", className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createInvoke("java.lang.Object", "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  public void createBackup() {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[]{}, "backup", className, il, _cp);
+
+    for (Property p : properties) {
+      InstructionHandle ih_0 = il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+      il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+      il.append(_factory.createFieldAccess(className, p.name, p.type, Constants.GETFIELD));
+      il.append(_factory.createFieldAccess(className, p.name + "$", p.type, Constants.PUTFIELD));
+    }
+
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  public void createRecover() {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(ACC_PUBLIC, Type.VOID, Type.NO_ARGS, new String[]{}, "recover", className, il, _cp);
+
+    for (Property p : properties) {
+      InstructionHandle ih_0 = il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+      il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+      il.append(_factory.createFieldAccess(className, p.name + "$", p.type, Constants.GETFIELD));
+      il.append(_factory.createFieldAccess(className, p.name, p.type, Constants.PUTFIELD));
+    }
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void createGetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(Constants.ACC_PUBLIC, p.type, Type.NO_ARGS, new String[]{}, p.getMethod.getName(), className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(_factory.createFieldAccess(className, p.name, p.type, Constants.GETFIELD));
+    il.append(InstructionFactory.createReturn(p.type));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+
+  private void createSetMethod(Property p) {
+    InstructionList il = new InstructionList();
+    MethodGen method = new MethodGen(Constants.ACC_PUBLIC, Type.VOID, new Type[]{p.type}, new String[]{"value"}, p.setMethod.getName(), className, il, _cp);
+
+    il.append(InstructionFactory.createLoad(Type.OBJECT, 0));
+    il.append(InstructionFactory.createLoad(p.type, 1));
+    il.append(_factory.createFieldAccess(className, p.name, p.type, Constants.PUTFIELD));
+    il.append(InstructionFactory.createReturn(Type.VOID));
+    method.setMaxStack();
+    method.setMaxLocals();
+    _cg.addMethod(method.getMethod());
+    il.dispose();
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/invisible/Adapter.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/invisible/Adapter.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/invisible/Adapter.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,262 @@
+/*
+ * Adapter.java
+ *
+ * Created on April 27, 2007, 4:03 PM
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.
+ *
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ *
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.
+ *
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.factory.shadow.invisible;
+import dstm2.ContentionManager;
+import dstm2.Transaction;
+import dstm2.exceptions.AbortedException;
+import dstm2.exceptions.PanicException;
+import dstm2.Thread;
+import dstm2.factory.shadow.Recoverable;
+import dstm2.factory.shadow.RecoverableFactory;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Callable;
+
+/**
+ * Shadow-field atomic object implementation. Visible reads.
+ * @param T object type
+ * @author Maurice Herlihy
+ */
+public class Adapter<T> implements dstm2.factory.Adapter<T> {
+  Class<T> iface;
+  T version;
+  Recoverable rVersion;
+  ContentionManager manager;
+  Transaction writer;
+  long versionNumber;
+  private final static String FORMAT = "Unexpected transaction state: %s";
+  /**
+   * A transaction switches to exclusive mode after being aborted this many times.
+   */
+  public static final int CONFLICT_THRESHOLD = 8;
+  
+  static Map<Class, RecoverableFactory> factoryMap
+      = new HashMap<Class, RecoverableFactory>();
+  
+  /**
+   * Creates a new instance of Adapter
+   * @param _class object run-time type
+   */
+  public Adapter(Class<T> _class) {
+    iface = _class;
+    RecoverableFactory<T> factory = factoryMap.get(iface);
+    if (factory == null) {
+      factory = new RecoverableFactory<T>(iface);
+      factoryMap.put(iface, factory);
+    }
+    version = factory.create();
+    rVersion = (Recoverable)version;
+    manager = Thread.getContentionManager();
+    writer = Transaction.COMMITTED;
+    versionNumber = 0;
+  }
+  
+  @Override
+  public <V> Adapter.Setter<V> makeSetter(String methodName, Class<V> _class) {
+    try {
+      final Method method = version.getClass().getMethod(methodName, _class);
+      return new Adapter.Setter<V>() {
+        @Override
+        public void call(V value) {
+          try {
+            Transaction me  = Thread.getTransaction();
+            Transaction other = null;
+            while (true) {
+              synchronized (Adapter.this) {
+                other = openWrite(me);
+                if (other == null) {
+                  method.invoke(version, value);
+                  versionNumber++;
+                  return;
+                }
+              }
+              if (other != null) {
+                manager.resolveConflict(me, other);
+              }
+            }
+          } catch (IllegalAccessException e) {
+            throw new PanicException(e);
+          } catch (InvocationTargetException e) {
+            throw new PanicException(e);
+          }
+        }};
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+  }
+  
+  @Override
+  public <V> Adapter.Getter<V> makeGetter(String methodName, Class<V> _class)  {
+    try {
+      final Method method = version.getClass().getMethod(methodName);
+      return new Adapter.Getter<V>() {
+        @Override
+        public V call() {
+          try {
+            Transaction me  = Thread.getTransaction();
+            Transaction other = null;
+            while (true) {
+              synchronized (Adapter.this) {
+                other = openRead(me);
+                if (other == null) {
+                  return (V)method.invoke(version);
+                }
+              }
+              manager.resolveConflict(me, other);
+            }
+          } catch (SecurityException e) {
+            throw new PanicException(e);
+          } catch (IllegalAccessException e) {
+            throw new PanicException(e);
+          } catch (InvocationTargetException e) {
+            throw new PanicException(e);
+          }
+        }};
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+  }
+  /**
+   * Tries to open object for reading. Returns reference to conflictin transaction, if one exists
+   ** @param me calling transaction
+   * @return conflicting transaction or <code>null</code>
+   */
+  public Transaction openRead(Transaction me) {
+    // don't try read sharing if contention seems high
+    if (me == null) {	// restore object if latest writer aborted
+      if (writer.isAborted()) {
+        rVersion.recover();
+        writer = Transaction.COMMITTED;
+      }
+      return null;
+    }
+    if (me.attempts > CONFLICT_THRESHOLD) {
+      return openWrite(me);
+    }
+    // Am I still active?
+    if (!me.isActive()) {
+      throw new AbortedException();
+    }
+    // Have I already opened this object?
+    if (writer == me) {
+      return null;
+    }
+    switch (writer.getStatus()) {
+      case ACTIVE:
+        return writer;
+      case COMMITTED:
+        break;
+      case ABORTED:
+        rVersion.recover();
+        break;
+      default:
+        throw new PanicException(FORMAT, writer.getStatus());
+    }
+    writer = Transaction.COMMITTED;
+    LocalReadSet.getLocal().add(this, versionNumber);
+    manager.openSucceeded();
+    return null;
+  }
+  
+  /**
+   * Tries to open object for reading.
+   * Returns reference to conflicting transaction, if one exists
+   **/
+  Transaction openWrite(Transaction me) {
+    boolean cacheHit = false;  // already open for read?
+    // not in a transaction
+    if (me == null) {	// restore object if latest writer aborted
+      if (writer.isAborted()) {
+        rVersion.recover();
+        writer = Transaction.COMMITTED;
+      }
+      return null;
+    }
+    if (!me.isActive()) {
+      throw new AbortedException();
+    }
+    if (me == writer) {
+      return null;
+    }
+    switch (writer.getStatus()) {
+      case ACTIVE:
+        return writer;
+      case COMMITTED:
+        rVersion.backup();
+        break;
+      case ABORTED:
+        rVersion.recover();
+        break;
+      default:
+        throw new PanicException(FORMAT, writer.getStatus());
+    }
+    writer = me;
+    if (!cacheHit) {
+      me.memRefs++;
+      manager.openSucceeded();
+    }
+    // remove from read set
+    LocalReadSet.getLocal().release(this);
+    return null;
+  }
+  public static Callable<Boolean> onValidate() {
+    return new Callable<Boolean>() {
+      @Override
+      public Boolean call() {
+        return LocalReadSet.validate();
+      }
+    };
+  }
+  public static Runnable onCommit() {
+    return new Runnable() {
+      @Override
+      public void run() {
+        LocalReadSet.cleanup();
+      }
+    };
+  }
+  public static Runnable onAbort() {
+    return new Runnable() {
+      @Override
+      public void run() {
+        LocalReadSet.cleanup();
+      }
+    };
+  }
+  
+}
+

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/invisible/LocalReadSet.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/invisible/LocalReadSet.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/shadow/invisible/LocalReadSet.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,90 @@
+/*
+ * LocalReadSet.java
+ *
+ * Created on April 27, 2007, 9:55 AM
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+
+package dstm2.factory.shadow.invisible;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * Thread-local read set used for invisible reads
+ * @author Maurice Herlihy
+ */
+public class LocalReadSet {
+  static ThreadLocal<Map<Adapter,Long>> local = new ThreadLocal<Map<Adapter,Long>>() {
+    @Override
+    protected Map<Adapter,Long> initialValue() {
+      return new HashMap<Adapter,Long>();
+    }
+  };
+  
+  Map<Adapter,Long> map;
+  
+  private LocalReadSet() {
+    map = local.get();
+  }
+  public static LocalReadSet getLocal() {
+    return new LocalReadSet();
+  }
+  
+  public void add(Adapter key, long value) {
+    map.put(key, value);
+  }
+  
+  public boolean release(Adapter key) {
+    return map.remove(key) != null;
+  }
+  
+  public static boolean validate() {
+    Map<Adapter,Long> localMap = local.get();
+    try {
+      for (Entry<Adapter,Long> entry : localMap.entrySet()) {
+        Adapter key = entry.getKey();
+        long value = entry.getValue();
+        if (value != key.versionNumber) {
+          return false;
+        }
+      }
+      return true;
+    } finally {
+      localMap.clear();
+    }
+  }
+  
+  public static void cleanup() {
+    local.get().clear();
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/twophase/Adapter.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/twophase/Adapter.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/factory/twophase/Adapter.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,131 @@
+/*
+ * Adapter.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.factory.twophase;
+
+import dstm2.exceptions.PanicException;
+import dstm2.factory.Factory;
+import dstm2.boosting.TwoPhase;
+import dstm2.factory.shadow.Recoverable;
+import dstm2.factory.shadow.RecoverableFactory;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Simple two-phase locking implementation.
+ * <b>Warning</b>
+ * This class is intended for tutorial purposes only. It is inefficient, but
+ * does a pretty good job of illustrating basic mechanisms.
+ * @param <T> type of object created
+ * @author Maurice Herlihy
+ */
+public class Adapter<T> implements dstm2.factory.Adapter<T> {
+
+  T version;
+  TwoPhase lock;
+  boolean firstTime;
+  private static Map<Class, Factory> map = new HashMap<Class, Factory>();
+
+  /**
+   * Creates a new instance of Adapter
+   * @param _class class of object created
+   */
+  public Adapter(Class<T> _class) {
+    lock = new TwoPhase();
+    Factory<T> factory = map.get(_class);
+    if (factory == null) {
+      factory = new RecoverableFactory(_class);
+      map.put(_class, factory);
+    }
+    version = factory.create();
+    firstTime = true;
+  }
+
+  @Override
+  public <V> Adapter.Getter<V> makeGetter(String methodName, Class<V> _class) {
+    try {
+      final Method method = version.getClass().getMethod(methodName);
+      return new Adapter.Getter<V>() {
+        @Override
+        public V call() {
+          try {
+            lock.lock();
+            if (firstTime) {
+              ((Recoverable) version).backup();
+              firstTime = false;
+            }
+            return (V) method.invoke(version);
+          } catch (IllegalArgumentException ex) {
+            throw new PanicException(ex);
+          } catch (IllegalAccessException ex) {
+            throw new PanicException(ex);
+          } catch (InvocationTargetException ex) {
+            throw new PanicException(ex);
+          }
+        }
+      };
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+  }
+
+  @Override
+  public <V> Adapter.Setter<V> makeSetter(String methodName, Class<V> _class) {
+    try {
+      final Method method = version.getClass().getMethod(methodName, _class);
+      return new Adapter.Setter<V>() {
+
+        @Override
+        public void call(V value) {
+          try {
+            lock.lock();
+            if (firstTime) {
+              ((Recoverable) version).backup();
+              firstTime = false;
+            }
+            method.invoke(version, value);
+          } catch (IllegalArgumentException ex) {
+            throw new PanicException(ex);
+          } catch (IllegalAccessException ex) {
+            throw new PanicException(ex);
+          } catch (InvocationTargetException ex) {
+            throw new PanicException(ex);
+          }
+        }
+      };
+    } catch (NoSuchMethodException e) {
+      throw new PanicException(e);
+    }
+  }
+}
+

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/AggressiveManager.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/AggressiveManager.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/AggressiveManager.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,59 @@
+/*
+ * AggressiveManager.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.manager;
+
+import dstm2.Transaction;
+
+/**
+ * The Chuck Norris contention manager:  always abort other transaction.
+ * @author Maurice Herlihy
+ */
+public class AggressiveManager extends BaseManager {
+  
+  public AggressiveManager() {
+  }
+  @Override
+  public void resolveConflict(Transaction me, Transaction other) {
+      other.abort();	
+  }
+  
+  @Override
+  public long getPriority() {
+    throw new UnsupportedOperationException();
+  }
+  
+  @Override
+  public void setPriority(long value) {
+    throw new UnsupportedOperationException();
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/BackoffManager.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/BackoffManager.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/BackoffManager.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,82 @@
+/*
+ * BackoffManager.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.
+ *
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ *
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.
+ *
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.manager;
+
+import dstm2.util.Random;
+import dstm2.Transaction;
+import dstm2.exceptions.GracefulException;
+import dstm2.Thread;
+
+/**
+ * Contention manager employing simple exponential backoff.
+ * @author Maurice Herlihy
+ */
+public class BackoffManager extends BaseManager {
+
+  static final int MIN_LOG_BACKOFF = 4;
+  static final int MAX_LOG_BACKOFF = 26;
+  static final int MAX_RETRIES = 22;
+  static final int BACKOFF_DIVISOR = 1000000;
+  Random random;
+  int currentAttempt = 0;
+
+  public BackoffManager() {
+    random = new Random();
+  }
+
+  @Override
+  public void openSucceeded() {
+    super.openSucceeded();
+    currentAttempt = 0;
+  }
+
+  @Override
+  public void resolveConflict(Transaction me, Transaction other) {
+    if (!other.isActive() || me.isAborted() || other == me) {
+      return;
+    }
+    if (Thread.stop) {
+      throw new GracefulException();
+    }
+    int logBackoff = currentAttempt - 2 + MIN_LOG_BACKOFF;
+    if (logBackoff > MAX_LOG_BACKOFF) {
+      logBackoff = MAX_LOG_BACKOFF;
+    }
+    int sleep = random.nextInt(1 << logBackoff);
+    super.sleep(sleep);
+    currentAttempt++;
+    if (currentAttempt == MAX_RETRIES) {
+      other.abort();
+      currentAttempt = 0;
+    }
+  }
+}
\ No newline at end of file

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/BaseManager.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/BaseManager.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/BaseManager.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,101 @@
+/*
+ * BaseManager.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.
+ *
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ *
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.
+ *
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.manager;
+
+import dstm2.ContentionManager;
+import dstm2.Transaction;
+import java.util.Collection;
+
+/**
+ *
+ * @author mph
+ */
+public abstract class BaseManager implements ContentionManager {
+
+  long priority;
+
+  /** Creates a new instance of BaseManager */
+  public BaseManager() {
+    priority = 0;
+  }
+
+  @Override
+  public abstract void resolveConflict(Transaction me, Transaction other);
+
+  @Override
+  public void resolveConflict(Transaction me, Collection<Transaction> other) {
+    for (Transaction t : other) {
+      if (me != t) {
+        resolveConflict(me, t);
+      }
+      if (me.isAborted()) {
+        break;
+      }
+    }
+  }
+
+  @Override
+  public long getPriority() {
+    return priority;
+  }
+
+  @Override
+  public void setPriority(long value) {
+    priority = value;
+  }
+
+  @Override
+  public void openSucceeded() {
+  }
+
+  /**
+   * Local-spin sleep method -- more accurate than DSTM2Thread.sleep()
+   * Difference discovered by V. Marathe.
+   * @param ns nanoseconds to sleap
+   */
+  protected void sleep(int ns) {
+    long startTime = System.nanoTime();
+    long stopTime = 0;
+    do {
+      stopTime = System.nanoTime();
+    } while ((stopTime - startTime) < ns);
+  }
+
+  @Override
+  public void committed() {
+  }
+
+  public boolean isDeterministic() {
+    return false;
+  }
+}
\ No newline at end of file

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/EruptionManager.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/EruptionManager.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/EruptionManager.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,102 @@
+/*
+ * EruptionManager.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.manager;
+
+import dstm2.ContentionManager;
+import dstm2.Transaction;
+
+/**
+ * Resolves conflicts by increasing pressure on the transactions that
+ * a blocked transaction is waiting on, eventually causing them to
+ * erupt through to completion. The way this works is that each time a
+ * block is successfully opened, the transaction gains one point of
+ * "momentum". When a transaction finds itself blocked by another of
+ * higher priority, it adds its momentum (priority) to the other
+ * transaction and then waits for the other transaction to complete.
+ * Like the Karma manager, Eruption will only wait around so long
+ * before clobbering the other transaction and going on anyway; the
+ * maximum wait is proportional to the square of the difference in
+ * priorities between the two transactions. Of course, at contention
+ * time, if the other transaction has a lower priority, we just erupt
+ * past it.
+ *
+ * The reasoning behind this management scheme is that if a particular
+ * transaction is blocking resources critical to many other
+ * transactions, it will gain all of their priority in addition to its
+ * own and thus be much more likely to finish quickly and get out of
+ * the way of all the others.
+ *
+ * Note that while a transaction is blocked, other transactions can
+ * pile up behind it and increase its priority enough to outweigh the
+ * transaction it's blocked behind.
+ *
+ * @author Bill Scherer
+ *
+ **/
+
+public class EruptionManager extends BaseManager {
+  static final int SLEEP_PERIOD = 1000;
+  long transferred = 0;
+  
+  /** Creates a new instance of EruptionManager */
+  public EruptionManager() {
+    priority = 0;
+  }
+  
+  @Override
+  public void resolveConflict(Transaction me, Transaction other) {
+    ContentionManager otherManager = other.getContentionManager();
+    for (int attempts = 0; ; attempts++) {
+	    if(other.isActive()) {
+	      long otherPriority = otherManager.getPriority();
+	      long delta = otherPriority - priority;
+	      if (attempts > delta) {
+	        other.abort();
+	        return;
+	      }
+	      // Unsafe increment, but too expensive to synchronize.
+	      if (priority > transferred) {
+	        otherManager.setPriority(otherPriority + priority - transferred);
+	        transferred = priority;
+	      }
+	    } else break;
+    }
+  }
+  
+  @Override
+  public void openSucceeded() {
+    priority++;
+    transferred = 0;
+  }
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/GreedyManager.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/GreedyManager.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/GreedyManager.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,71 @@
+/*
+ * GreedyManager.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.
+ *
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ *
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.
+ *
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.manager;
+
+import dstm2.Transaction;
+
+/**
+ * Tries to keep a maximal independent set running.
+ * If prior transaction is
+ *		waiting or lower priority, then abort it.
+ *		otherwise, wait for it to commit, abort, or wait
+ * Complete description in
+ *		Rachid Guerraoui, Maurice Herlihy, and Sebastian Pochon, Toward a Theory of Transactional Contention Management,
+ *		Proceedings of the Twenty-Fourth Annual Symposium on Principles of Distributed Computing (PODC).
+ *		Las Vegas, NV July 2005.
+ * @author Maurice Herlihy
+ */
+public class GreedyManager extends BaseManager {
+  @Override
+  public void resolveConflict(Transaction me, Transaction other) {
+    if (other.waiting || other.startTime > me.startTime) {
+      other.abort();
+    } else {
+      me.waiting = true;		// I'm waiting
+      other.waitWhileActiveNotWaiting();
+      me.waiting = false;		// I'm no longer waiting
+    }
+  }
+  /**
+   * Reset priority only on commit. On abort, restart with previous priority.
+   **/
+  @Override
+  public void committed() {
+    setPriority(0);
+  }
+  
+  @Override
+  public void openSucceeded() {
+    setPriority(getPriority() + 1);
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/KarmaManager.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/KarmaManager.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/KarmaManager.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,89 @@
+/*
+ * KarmaManager.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.manager;
+import dstm2.Transaction;
+import dstm2.ContentionManager;
+
+/**
+ * Uses "karmic debt management" to resolve conflicts.  Roughly, a
+ * thread gains "karma" for every object it successfully opens, and
+ * threads with greater karma can abort transactions of other threads.
+ * A thread's karma is reset every time it successfully commits a
+ * transaction, but not when it is aborted (hence the name).
+ *
+ * When conflict occurs between two transactions, the one with the
+ * greater accumulated karma wins. If the other transaction holds a
+ * block, it gets aborted immediately. Otherwise, the "lesser"
+ * transaction backs off for a fixed interval and up to the square of
+ * the difference in karma bethere the two.
+ *
+ * The key idea behind this policy is that it allows long transactions
+ * to eventually finish even if mixed with lots of competing shorter
+ * transactions. This happens because the longer transaction will
+ * accumulate more and more karma each time it gets aborted, so it
+ * will eventually reach "critical mass" and be able to bulldoze its
+ * way through to get its work done.
+ *
+ * @author Bill Scherer
+ **/
+
+public class KarmaManager extends BaseManager {
+  static final int SLEEP_PERIOD = 100;
+  
+  @Override
+  public void resolveConflict(Transaction me, Transaction other) {
+	ContentionManager otherManager = other.getContentionManager();
+    for (int attempts = 0; ; attempts++) {
+        if(other.isActive()) {
+		      long delta = otherManager.getPriority() - priority;
+		      if (attempts > delta) {
+		        other.abort();
+		      }
+	    } else break;
+    }
+  }
+  
+  /**
+   * Reset priority only on commit. On abort, restart with previous priority.
+   * "Cosmic debt"?. More like cosmic credit.
+   **/
+  @Override
+  public void committed() {
+    setPriority(0);
+  }
+  
+  @Override
+  public void openSucceeded() {
+    setPriority(getPriority() + 1);
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/KindergartenManager.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/KindergartenManager.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/KindergartenManager.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,76 @@
+/*
+ * KindergartenManager.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.manager;
+
+import dstm2.Transaction;
+import dstm2.util.Random;
+import java.util.TreeSet;
+
+/**
+ * Transactions take turns playing with blocks.
+ *
+ * @author Bill Scherer
+ */
+public class KindergartenManager extends BaseManager {
+  static final int SLEEP_PERIOD = 1000; // was 100
+  static final int MAX_RETRIES = 100; // was 10
+  TreeSet<KindergartenManager> otherChildren;
+  
+  /** Creates new <code>Kindergarten</code> manager */
+  public KindergartenManager() {
+    super();
+    otherChildren = new TreeSet<KindergartenManager>();
+    otherChildren.add(this);
+  }
+  
+  @Override
+  public void resolveConflict(Transaction me, Transaction other) {
+    try {
+      KindergartenManager otherManager =
+          (KindergartenManager) other.getContentionManager();
+      // first, check sharing records.
+      if (otherChildren.contains(otherManager)) {
+        otherChildren.remove(otherManager);
+        other.abort();                      // My turn! My turn!
+        return;
+      } else {
+    	  otherChildren.add(otherManager);
+      }
+      me.abort(); // give up
+      return;
+    } catch (ClassCastException e) {
+      other.abort(); // Oh, other not a Kindergartener. Kill it.
+      return;
+    }
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/NullManager.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/NullManager.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/NullManager.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,59 @@
+/*
+ * NullManager.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.manager;
+
+import dstm2.Transaction;
+
+/**
+ * Placeholder manager.
+ * @author Maurice Herlihy
+ */
+public class NullManager extends BaseManager {
+  
+  public NullManager() {
+  }
+  @Override
+  public void resolveConflict(Transaction me, Transaction other) {
+    throw new UnsupportedOperationException();
+  }
+  
+  @Override
+  public long getPriority() {
+    throw new UnsupportedOperationException();
+  }
+  
+  @Override
+  public void setPriority(long value) {
+    throw new UnsupportedOperationException();
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/PolkaManager.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/PolkaManager.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/PolkaManager.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,71 @@
+package dstm2.manager;
+
+import java.util.Collection;
+
+import dstm2.Transaction;
+
+public class PolkaManager extends BackoffManager {
+
+  @Override
+  public void resolveConflict(Transaction me, Transaction other) {
+    if (other.getContentionManager().getPriority() >
+        currentAttempt + me.getContentionManager().getPriority()) {
+      if (!other.isActive()) {
+        return;
+      }
+      int logBackoff = currentAttempt - 2 + MIN_LOG_BACKOFF;
+      if (logBackoff > MAX_LOG_BACKOFF) {
+        logBackoff = MAX_LOG_BACKOFF;
+      }
+      int sleep = random.nextInt(1 << logBackoff);
+      try {
+        Thread.sleep(sleep / 1000000, sleep % 1000000);
+      } catch (InterruptedException ex) {
+        Thread.currentThread().interrupt();
+      }
+      currentAttempt++;
+    } else {
+      other.abort();
+      currentAttempt = 0;
+    }
+  }
+
+  @Override
+  public void resolveConflict(Transaction me, Collection<Transaction> others) {
+    for (Transaction other : others) {
+      if (other.getContentionManager().getPriority() >
+          currentAttempt + me.getContentionManager().getPriority()) {
+        int logBackoff = currentAttempt - 2 + MIN_LOG_BACKOFF;
+        if (logBackoff > MAX_LOG_BACKOFF) {
+          logBackoff = MAX_LOG_BACKOFF;
+        }
+        int sleep = random.nextInt(1 << logBackoff);
+        try {
+          Thread.sleep(sleep / 1000000, sleep % 1000000);
+        } catch (InterruptedException ex) {
+          Thread.currentThread().interrupt();
+        }
+        currentAttempt++;
+      } else {
+        if (other.isActive() && other != me) {
+          other.abort();
+        }
+      }
+    }
+    currentAttempt = 0;
+  }
+
+  /**
+   * Reset priority only on commit. On abort, restart with previous priority.
+   **/
+  @Override
+  public void committed() {
+    setPriority(0);
+  }
+
+  @Override
+  public void openSucceeded() {
+    super.openSucceeded();
+    setPriority(getPriority() + 1);
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/PriorityManager.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/PriorityManager.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/manager/PriorityManager.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,72 @@
+/*
+ * PriorityManager.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.manager;
+
+import dstm2.Transaction;
+
+/**
+ * Older transaction always wins.
+ * @author Maurice Herlihy
+ */
+public class PriorityManager extends BaseManager {
+
+  public PriorityManager() {
+  }
+
+  @Override
+  public void resolveConflict(Transaction me, Transaction other) {
+    if (me.equals(other)) {
+      return;
+    }
+    if (me.startTime < other.startTime) {
+      other.abort();
+    } else if (me.startTime > other.startTime) {
+      other.waitWhileActive();
+    } else if (me.hashCode() < other.hashCode()) {
+      other.abort();
+    } else if (me.hashCode() > other.hashCode()) {
+      other.waitWhileActive();
+    } else {
+    other.abort();
+    }
+  }
+
+  @Override
+  public long getPriority() {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public void setPriority(long value) {
+    throw new UnsupportedOperationException();
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/AtomicArray.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/AtomicArray.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/AtomicArray.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,22 @@
+/* 
+ * Atomic array
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.util;
+
+import dstm2.atomic;
+
+/**
+ * Atomic array with boosting.
+ * @author mph
+ */
+ at atomic
+public interface AtomicArray<T> {
+  public void set(final int i, T v);
+  public T get(int i);
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/BoostedArray.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/BoostedArray.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/BoostedArray.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,51 @@
+/* 
+ * Count-down latch
+ *
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+package dstm2.util;
+
+import dstm2.Thread;
+import dstm2.atomic;
+import dstm2.boosting.TwoPhaseMap;
+import java.lang.reflect.Array;
+
+/**
+ * Atomic array with boosting.
+ * @author mph
+ */
+ at atomic
+public class BoostedArray<T> implements AtomicArray<T> {
+
+  private T[] array;
+  private TwoPhaseMap lockMap;
+
+  public BoostedArray(Class _class, int capacity) {
+    array = (T[]) Array.newInstance(_class, capacity);
+    lockMap = new TwoPhaseMap();
+  }
+
+  @Override
+  public void set(final int i, T v) {
+    lockMap.get(i).lock();
+    final T prior = array[i];
+    array[i] = v;
+    Thread.onAbortOnce(new Runnable() {
+
+      @Override
+      public void run() {
+        array[i] = prior;
+      }
+    });
+  }
+
+  @Override
+  public T get(int i) {
+    lockMap.get(i).lock();
+    return array[i];
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/BoostedInteger.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/BoostedInteger.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/BoostedInteger.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,55 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package dstm2.util;
+
+import dstm2.Thread;
+import dstm2.boosting.TwoPhase;
+
+/**
+ *
+ * @author mph
+ */
+public class BoostedInteger {
+
+  TwoPhase lock;
+  java.util.concurrent.atomic.AtomicInteger counter;
+
+  public BoostedInteger() {
+    this(0);
+  }
+
+  public BoostedInteger(int init) {
+    counter = new java.util.concurrent.atomic.AtomicInteger(init);
+    lock = new TwoPhase();
+  }
+
+  public int get() {
+    lock.lock();
+    return counter.get();
+  }
+
+  public int getAndIncrement() {
+    lock.lock();
+    Thread.onAbortOnce(new Runnable() {
+      @Override
+      public void run() {
+        counter.getAndDecrement();
+      }
+    });
+    return counter.getAndIncrement();
+  }
+
+  public int getAndDecrement() {
+    lock.lock();
+    Thread.onAbortOnce(new Runnable() {
+
+      @Override
+      public void run() {
+        counter.getAndIncrement();
+      }
+    });
+    return counter.getAndDecrement();
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/BoostedSkipList.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/BoostedSkipList.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/BoostedSkipList.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,87 @@
+/*
+ * SkipListKey.java
+ *
+ * Created on April 13, 2007, 2:58 PM
+ * 
+ * Copyright 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document.  In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements.  Use is subject to license terms.  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws  and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited.  Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.util;
+
+import dstm2.Main;
+import dstm2.boosting.*;
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentSkipListSet;
+import dstm2.Thread;
+
+/**
+ * Transactional boosting:
+ * Doug Lea's ConcurrentSkipListSet boosted by key-based locks.
+ * 
+ * @param T item type
+ * @author Maurice Herlihy
+ * @deprecated use dstm2.util.AtomicArray instead
+ */
+public class BoostedSkipList<T> {
+  ConcurrentSkipListSet<Integer> list;
+  TwoPhaseMap lockMap;
+  
+  /**
+   * Creates a new instance of SkipListKey
+   */
+  public BoostedSkipList() {
+    list = new ConcurrentSkipListSet<Integer>();
+    lockMap = new TwoPhaseMap();
+  }
+  
+  public boolean add(final int v) {
+    lockMap.get(v).lock();
+    boolean result = list.add(v);
+    if (result) {
+      Thread.onAbortOnce(new Runnable() {
+        @Override
+        public void run() {
+          list.remove(v);
+        }});
+    }
+    return result;
+  }
+  public boolean remove(final int v) {
+    lockMap.get(v).lock();
+    boolean result = list.remove(v);
+    if (result) {
+      Thread.onAbortOnce(new Runnable() {
+        @Override
+        public void run() {
+          list.add(v);
+        }});
+    }
+    return result;
+  }
+  public boolean contains(final int v) {
+    lockMap.get(v).lock();
+    boolean result = list.add(v);
+    return result;
+  }
+
+  public Iterator<Integer> iterator() {
+    return list.iterator();
+  }
+  
+  public static void main(String [] args) {
+    String[] myArgs = {
+      "-m", "dstm2.manager.KarmaManager",
+      "-a", "dstm2.factory.shadow.Adapter",
+      "-b", "dstm2.util.AtomicSkipList",
+      "-t", "2",
+      "-n", "10000",
+      "-e", "100"
+    };
+    Main.main(myArgs);
+  }
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/Random.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/Random.java	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/src/dstm2/util/Random.java	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,255 @@
+/*
+ * Random.java
+ *
+ * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+ * Clara, California 95054, U.S.A.  All rights reserved.  
+ * 
+ * Sun Microsystems, Inc. has intellectual property rights relating to
+ * technology embodied in the product that is described in this
+ * document.  In particular, and without limitation, these
+ * intellectual property rights may include one or more of the
+ * U.S. patents listed at http://www.sun.com/patents and one or more
+ * additional patents or pending patent applications in the U.S. and
+ * in other countries.
+ * 
+ * U.S. Government Rights - Commercial software.
+ * Government users are subject to the Sun Microsystems, Inc. standard
+ * license agreement and applicable provisions of the FAR and its
+ * supplements.  Use is subject to license terms.  Sun, Sun
+ * Microsystems, the Sun logo and Java are trademarks or registered
+ * trademarks of Sun Microsystems, Inc. in the U.S. and other
+ * countries.  
+ * 
+ * This product is covered and controlled by U.S. Export Control laws
+ * and may be subject to the export or import laws in other countries.
+ * Nuclear, missile, chemical biological weapons or nuclear maritime
+ * end uses or end users, whether direct or indirect, are strictly
+ * prohibited.  Export or reexport to countries subject to
+ * U.S. embargo or to entities identified on U.S. export exclusion
+ * lists, including, but not limited to, the denied persons and
+ * specially designated nationals lists is strictly prohibited.
+ */
+
+package dstm2.util;
+
+import java.io.*;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * Lightweight random number generator.  <I>Not thread-safe.</I> Synchronization in the
+ * <CODE>java.util.Randome</CODE> can distort the performance of multithreaded benchmarks.
+ */
+public class Random extends java.util.Random {
+  
+  /** use serialVersionUID from JDK 1.1 for interoperability */
+  static final long serialVersionUID = 3905348978240129619L;
+  
+  private long seed;
+  
+  private final static long multiplier = 0x5DEECE66DL;
+  private final static long addend = 0xBL;
+  private final static long mask = (1L << 48) - 1;
+  
+  /**
+   * Creates a new random number generator. This constructor sets
+   * the seed of the random number generator to a value very likely
+   * to be distinct from any other invocation of this constructor.
+   */
+  public Random() { this(++seedUniquifier + System.nanoTime()); }
+  private static volatile long seedUniquifier = 8682522807148012L;
+  
+  /**
+   * Creates a new random number generator using a single
+   * <code>long</code> seed:
+   * <blockquote><pre>
+   * public Random(long seed) { setSeed(seed); }</pre></blockquote>
+   * Used by method <tt>next</tt> to hold
+   * the state of the pseudorandom number generator.
+   *
+   * @param   seed   the initial seed.
+   * @see     java.util.Random#setSeed(long)
+   */
+  public Random(long seed) {
+    this.seed = 0L;
+    setSeed(seed);
+  }
+  
+  /**
+   * Sets the seed of this random number generator using a single
+   * <code>long</code> seed. The general contract of <tt>setSeed</tt>
+   * is that it alters the state of this random number generator
+   * object so as to be in exactly the same state as if it had just
+   * been created with the argument <tt>seed</tt> as a seed. The method
+   * <tt>setSeed</tt> is implemented by class Random as follows:
+   * <blockquote><pre>
+   * synchronized public void setSeed(long seed) {
+   *       this.seed = (seed ^ 0x5DEECE66DL) & ((1L << 48) - 1);
+   *       haveNextNextGaussian = false;
+   * }</pre></blockquote>
+   * The implementation of <tt>setSeed</tt> by class <tt>Random</tt>
+   * happens to use only 48 bits of the given seed. In general, however,
+   * an overriding method may use all 64 bits of the long argument
+   * as a seed value.
+   *
+   * Note: Although the seed value is an AtomicLong, this method
+   *       must still be synchronized to ensure correct semantics
+   *       of haveNextNextGaussian.
+   *
+   * @param   seed   the initial seed.
+   */
+  public void setSeed(long seed) {
+    seed = (seed ^ multiplier) & mask;
+    this.seed = seed;
+    haveNextNextGaussian = false;
+  }
+  
+  /**
+   * Generates the next pseudorandom number. Subclass should
+   * override this, as this is used by all other methods.<p>
+   * The general contract of <tt>next</tt> is that it returns an
+   * <tt>int</tt> value and if the argument bits is between <tt>1</tt>
+   * and <tt>32</tt> (inclusive), then that many low-order bits of the
+   * returned value will be (approximately) independently chosen bit
+   * values, each of which is (approximately) equally likely to be
+   * <tt>0</tt> or <tt>1</tt>. The method <tt>next</tt> is implemented
+   * by class <tt>Random</tt> as follows:
+   * <blockquote><pre>
+   * synchronized protected int next(int bits) {
+   *       seed = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
+   *       return (int)(seed >>> (48 - bits));
+   * }</pre></blockquote>
+   * This is a linear congruential pseudorandom number generator, as
+   * defined by D. H. Lehmer and described by Donald E. Knuth in <i>The
+   * Art of Computer Programming,</i> Volume 2: <i>Seminumerical
+   * Algorithms</i>, section 3.2.1.
+   *
+   * @param   bits random bits
+   * @return  the next pseudorandom value from this random number generator's sequence.
+   * @since   JDK1.1
+   */
+  protected int next(int bits) {
+    seed = (seed * multiplier + addend) & mask;
+    return (int)(seed >>> (48 - bits));
+  }
+  
+  private static final int BITS_PER_BYTE = 8;
+  private static final int BYTES_PER_INT = 4;
+  
+  private double nextNextGaussian;
+  private boolean haveNextNextGaussian = false;
+  
+  /**
+   * Returns the next pseudorandom, Gaussian ("normally") distributed
+   * <code>double</code> value with mean <code>0.0</code> and standard
+   * deviation <code>1.0</code> from this random number generator's sequence.
+   * <p>
+   * The general contract of <tt>nextGaussian</tt> is that one
+   * <tt>double</tt> value, chosen from (approximately) the usual
+   * normal distribution with mean <tt>0.0</tt> and standard deviation
+   * <tt>1.0</tt>, is pseudorandomly generated and returned. The method
+   * <tt>nextGaussian</tt> is implemented by class <tt>Random</tt> as follows:
+   * <blockquote><pre>
+   * synchronized public double nextGaussian() {
+   *    if (haveNextNextGaussian) {
+   *            haveNextNextGaussian = false;
+   *            return nextNextGaussian;
+   *    } else {
+   *            double v1, v2, s;
+   *            do {
+   *                    v1 = 2 * nextDouble() - 1;   // between -1.0 and 1.0
+   *                    v2 = 2 * nextDouble() - 1;   // between -1.0 and 1.0
+   *                    s = v1 * v1 + v2 * v2;
+   *            } while (s >= 1 || s == 0);
+   *            double multiplier = Math.sqrt(-2 * Math.log(s)/s);
+   *            nextNextGaussian = v2 * multiplier;
+   *            haveNextNextGaussian = true;
+   *            return v1 * multiplier;
+   *    }
+   * }</pre></blockquote>
+   * This uses the <i>polar method</i> of G. E. P. Box, M. E. Muller, and
+   * G. Marsaglia, as described by Donald E. Knuth in <i>The Art of
+   * Computer Programming</i>, Volume 2: <i>Seminumerical Algorithms</i>,
+   * section 3.4.1, subsection C, algorithm P. Note that it generates two
+   * independent values at the cost of only one call to <tt>Math.log</tt>
+   * and one call to <tt>Math.sqrt</tt>.
+   *
+   * @return  the next pseudorandom, Gaussian ("normally") distributed
+   *          <code>double</code> value with mean <code>0.0</code> and
+   *          standard deviation <code>1.0</code> from this random number
+   *          generator's sequence.
+   */
+  public double nextGaussian() {
+    // See Knuth, ACP, Section 3.4.1 Algorithm C.
+    if (haveNextNextGaussian) {
+      haveNextNextGaussian = false;
+      return nextNextGaussian;
+    } else {
+      double v1, v2, s;
+      do {
+        v1 = 2 * nextDouble() - 1; // between -1 and 1
+        v2 = 2 * nextDouble() - 1; // between -1 and 1
+        s = v1 * v1 + v2 * v2;
+      } while (s >= 1 || s == 0);
+      double multiplier = Math.sqrt(-2 * Math.log(s)/s);
+      nextNextGaussian = v2 * multiplier;
+      haveNextNextGaussian = true;
+      return v1 * multiplier;
+    }
+  }
+  
+  /**
+   * Serializable fields for Random.
+   *
+   * @serialField    seed long;
+   *              seed for random computations
+   * @serialField    nextNextGaussian double;
+   *              next Gaussian to be returned
+   * @serialField      haveNextNextGaussian boolean
+   *              nextNextGaussian is valid
+   */
+  private static final ObjectStreamField[] serialPersistentFields = {
+    new ObjectStreamField("seed", Long.TYPE),
+        new ObjectStreamField("nextNextGaussian", Double.TYPE),
+        new ObjectStreamField("haveNextNextGaussian", Boolean.TYPE)
+  };
+  
+  /**
+   * Reconstitute the <tt>Random</tt> instance from a stream (that is,
+   * deserialize it). The seed is read in as long for
+   * historical reasons, but it is converted to an AtomicLong.
+   */
+  private void readObject(java.io.ObjectInputStream s)
+  throws java.io.IOException, ClassNotFoundException {
+    
+    ObjectInputStream.GetField fields = s.readFields();
+    long seedVal;
+    
+    seedVal = (long) fields.get("seed", -1L);
+    if (seedVal < 0)
+      throw new java.io.StreamCorruptedException(
+          "Random: invalid seed");
+    seed = seedVal;
+    nextNextGaussian = fields.get("nextNextGaussian", 0.0);
+    haveNextNextGaussian = fields.get("haveNextNextGaussian", false);
+  }
+  
+  
+  /**
+   * Save the <tt>Random</tt> instance to a stream.
+   * The seed of a Random is serialized as a long for
+   * historical reasons.
+   *
+   */
+  synchronized private void writeObject(ObjectOutputStream s) throws IOException {
+    // set the values of the Serializable fields
+    ObjectOutputStream.PutField fields = s.putFields();
+    fields.put("seed", seed);
+    fields.put("nextNextGaussian", nextNextGaussian);
+    fields.put("haveNextNextGaussian", haveNextNextGaussian);
+    
+    // save them
+    s.writeFields();
+    
+  }
+  
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Benchmark.pl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Benchmark.pl	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Benchmark.pl	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,121 @@
+#! /usr/bin/perl
+
+#############################################################################
+# syntax:
+# perl List.pl [benchmark] [manager] [adapter] [BATCH]
+# where
+#   [benchmark] is benchmark to run
+#     if "all", run all known benchmarks
+#     else run only "dstm2.benchmark.$benchmark"
+#   [manager] is contention manager name
+#     if "all", run all known managers
+#     else run only "dstm2.manager.${manager}Manager";
+#   [adapter] is adapter name
+#     if "all", run all known adapters
+#     else run only "dstm2.factory.".$adapter.".Adapter"
+#   [batch] is whether to batch run
+#     if "batch", pipe output to unique file.
+#############################################################################
+
+require v5.6.0;
+use IO::Handle;
+
+#############################################################################
+# Test parameters and configuration
+#
+# $configfile defines $codedir, $prog, $numprocs and $machinedesc
+
+$configfile = './config.pl';
+require $configfile;
+
+# Number of millisecond to run each benchmark
+$millis = 10000;
+
+$| = 1;				# flush stdout immediately after printf
+
+# Benchmark program
+if (!$ARGV[2]) {
+  print "usage: [benchmark | \"all\"] [manager | \"all\"] [adapter | \"all\"] [\"batch\"]\n";
+  flush;
+  die;
+}
+# Benchmark program
+if ($ARGV[0] eq "all") {
+  @benchmarks = (
+		 "RBTreeBenchmark",
+		 "ListBenchmark",
+		 "SkipListBenchmark",
+		 "boosting.ListBenchmark",
+		 "boosting.SkipListBenchmark",
+		);
+} else {
+  @benchmarks = (
+		 $ARGV[0]
+		);
+}
+
+# Contention manager
+if (!$ARGV[1] || $ARGV[1] eq "all") {
+  @managers = (
+ 	       "Aggressive",
+ 	       "Backoff",
+ 	       "Eruption",
+	       "Greedy",
+ 	       "Karma",
+ 	       "Kindergarten",
+ 	       "Polka",
+ 	       "Priority"
+	      );
+} else {
+  @managers = (
+	       ucfirst($ARGV[1])
+	      );
+}
+
+if (!$ARGV[2] || $ARGV[2] eq "all") {
+  @adapters = (
+ 	       "ofree",
+ 	       "shadow",
+ 	       "shadow.invisible",
+ 	       "recycle",
+ 	       "twophase",
+	      );
+} else {
+  @adapters = (
+	       $ARGV[2],
+	      );
+}
+$batch = ($ARGV[3] eq "batch");
+if ($batch) {
+  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
+  $timestamp = sprintf "-%02d-%02d-%02d%02d%02d",$mon+1,$mday,$hour,$min,$sec;
+  $filename = "./benchmark-" . $ARGV[0]. "-" . $ARGV[1] . "-" . $ARGV[2] . "-" . $ENV{HOSTNAME} . $timestamp . ".raw";
+  print "writing to $filename\n";
+  open (OUTPUT, ">$filename") || die $!;
+  STDOUT->fdopen(\*OUTPUT, "w") || die $!;
+  STDERR->fdopen(\*OUTPUT, "w") || die $!;
+}
+
+chdir($codedir) or die "Invalid $codedir directory specified in $configfile.";
+
+foreach $benchmark (@benchmarks) {
+  print "-->$benchmark\n";
+  $benchmarkClass = "dstm2.benchmark." . $benchmark;
+  foreach $m (@managers) {
+    $manager = "dstm2.manager.".$m."Manager";
+    foreach $eflag (100, 50, 0) {
+      foreach $thread (32, 16, 8, 4, 2, 1) {
+	foreach $a (@adapters) {
+	  $adapter = "dstm2.factory.".$a.".Adapter";
+	  $command = "$prog -m $manager -a $adapter -b $benchmarkClass -t $thread -n $millis -e $eflag";
+	  my $now = localtime;
+	  print "$now\n$command\n";
+	  system("$command") == 0 or die "command failed: $!\n";
+	}
+      }
+    }
+  }
+}
+if (batch) {
+  close OUTPUT;
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/List.pl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/List.pl	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/List.pl	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,108 @@
+#! /usr/bin/perl
+
+#############################################################################
+# syntax:
+# perl List.pl [manager] [adapter] [batch]
+# where
+#   [manager] is contention manager name
+#     if "all", run all known managers
+#     else run only "dstm2.manager.$manager.Manager";
+#   [adapter] is adapter name
+#     if "all", run all known adapters
+#     else run only "dstm2.factory.".$adapter.".Adapter"
+#   [batch] is whether to batch run
+#     if "batch", pipe output to unique file.
+#############################################################################
+
+require v5.6.0;
+use IO::Handle;
+
+#############################################################################
+# Test parameters and configuration
+#
+# $configfile defines $codedir, $prog, $numprocs and $machinedesc
+
+$configfile = './config.pl';
+require $configfile;
+
+# Benchmark program
+$benchmark = "ListBenchmark";
+$benchmarkClass = "dstm2.benchmark.$benchmark";
+
+# Number of millisecond to run each benchmark
+$millis = 10000;
+
+###
+### Run the benchmark
+###
+
+$| = 1;				# flush stdout immediately after printf
+
+# Contention manager
+if (!$ARGV[0] || $ARGV[0] eq "all") {
+  @managers = (
+# 	       "Aggressive",
+ 	       "Backoff",
+# 	       "Eruption",
+	       "Greedy",
+#  	       "Karma",
+#  	       "Kindergarten",
+#  	       "Polka",
+#  	       "Priority"
+	      );
+} else {
+  @managers = (
+	       ucfirst($ARGV[0])
+	      );
+}
+
+if (!$ARGV[1] || $ARGV[1] eq "all") {
+  @adapters = (
+ 	       "ofree",
+ 	       "shadow",
+ 	       "shadow.invisible",
+ 	       "recycle",
+ 	       "twophase",
+	      );
+} else {
+  @adapters = (
+	       $ARGV[1],
+	      );
+}
+$batch = ($ARGV[2] eq "batch");
+if ($batch) {
+  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
+  $timestamp = sprintf "-%02d-%02d-%02d%02d%02d",$mon+1,$mday,$hour,$min,$sec;
+  $filename = "./$benchmark" . "-" . $ARGV[1] . "-" . $ENV{HOSTNAME} . $timestamp . ".raw";
+  print "writing to $filename\n";
+  open (OUTPUT, ">$filename") || die $!;
+  STDOUT->fdopen(\*OUTPUT, "w") || die $!;
+  STDERR->fdopen(\*OUTPUT, "w") || die $!;
+}
+
+chdir($codedir) or die "Invalid $codedir directory specified in $configfile.";
+
+foreach $m (@managers) {
+  $manager = "dstm2.manager.".$m."Manager";
+  foreach $eflag (100, 50, 0) {
+    foreach $thread (32, 16, 8, 4, 2, 1) {
+      foreach $a (@adapters) {
+	$adapter = "dstm2.factory.".$a.".Adapter";
+	$command = "$prog -m $manager -a $adapter -b $benchmarkClass -t $thread -n $millis -e $eflag";
+	my $now = localtime;
+	print "$now\n$command\n";
+	system("$command") == 0 or die "command failed: $!\n";
+      }
+      $manager = "dstm2.manager.NullManager";
+      $adapter = "dstm2.factory.ofree.Adapter";
+      $benchmarkClass = "dstm2.benchmark.boosting.$benchmark";
+      $command = "$prog -m $manager -a $adapter -b $benchmarkClass -t $thread -n $millis -e $eflag";
+      my $now = localtime;
+      print "$now\n$command\n";
+      system("$command") == 0 or die "command failed: $!\n";
+    }
+  }
+}
+if (batch) {
+  close OUTPUT;
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Ofree.pl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Ofree.pl	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Ofree.pl	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,122 @@
+#! /usr/bin/perl
+
+#############################################################################
+# syntax:
+# perl List.pl [benchmark] [manager] [adapter] [BATCH]
+# where
+#   [benchmark] is benchmark to run
+#     if "all", run all known benchmarks
+#     else run only "dstm2.benchmark.$benchmark"
+#   [manager] is contention manager name
+#     if "all", run all known managers
+#     else run only "dstm2.manager.${manager}Manager";
+#   [adapter] is adapter name
+#     if "all", run all known adapters
+#     else run only "dstm2.factory.".$adapter.".Adapter"
+#   [batch] is whether to batch run
+#     if "batch", pipe output to unique file.
+#############################################################################
+
+require v5.6.0;
+use IO::Handle;
+
+#############################################################################
+# Test parameters and configuration
+#
+# $configfile defines $codedir, $prog, $numprocs and $machinedesc
+
+$configfile = './config.pl';
+require $configfile;
+
+# Number of millisecond to run each benchmark
+$millis = 10000;
+
+$| = 1;				# flush stdout immediately after printf
+
+# Benchmark program
+if (!$ARGV[0] || $ARGV[1] eq "all") {
+  @benchmarks = (
+		 "RBTreeBenchmark",
+		 "ListBenchmark",
+		 "SkipListBenchmark",
+		 "boosting.ListBenchmark",
+		 "boosting.SkipListBenchmark",
+		);
+} else {
+  @benchmarks = (
+		 ucfirst($ARGV[0])
+		);
+}
+
+###
+### Run the benchmark
+###
+
+
+# Contention manager
+if (!$ARGV[1] || $ARGV[1] eq "all") {
+  @managers = (
+ 	       "Aggressive",
+ 	       "Backoff",
+ 	       "Eruption",
+	       "Greedy",
+ 	       "Karma",
+ 	       "Kindergarten",
+ 	       "Polka",
+ 	       "Priority"
+	      );
+} else {
+  @managers = (
+	       ucfirst($ARGV[1])
+	      );
+}
+
+if (!$ARGV[2] || $ARGV[2] eq "all") {
+  @adapters = (
+ 	       "ofree",
+ 	       "shadow",
+ 	       "shadow.invisible",
+ 	       "recycle",
+ 	       "recycle2",
+ 	       "rls",
+ 	       "twophase",
+	      );
+} else {
+  @adapters = (
+	       $ARGV[2],
+	      );
+}
+$batch = ($ARGV[3] eq "batch");
+if ($batch) {
+  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
+  $timestamp = sprintf "-%02d-%02d-%02d%02d%02d",$mon+1,$mday,$hour,$min,$sec;
+  $filename = "./$benchmark
+    int myListLevel = listLevel.get();-" . $ARGV[1] . "-" . $ARGV[2] . "-" . $ENV{HOSTNAME} . $timestamp . ".raw";
+  print "writing to $filename\n";
+  open (OUTPUT, ">$filename") || die $!;
+  STDOUT->fdopen(\*OUTPUT, "w") || die $!;
+  STDERR->fdopen(\*OUTPUT, "w") || die $!;
+}
+
+chdir($codedir) or die "Invalid $codedir directory specified in $configfile.";
+
+foreach $benchmark (@benchmarks) {
+  $benchmarkclass = "dstm2.benchmark.$benchmark";
+  foreach $m (@managers) {
+    $manager = "dstm2.manager.".$m."Manager";
+    foreach $eflag (100, 50, 0) {
+      foreach $thread (32, 16, 8, 4, 2, 1) {
+	foreach $a (@adapters) {
+	  $adapter = "dstm2.factory.".$a.".Adapter";
+	  $command = "$prog -m $manager -a $adapter -b $benchmarkClass -t $thread -n $millis -e $eflag";
+	  my $now = localtime;
+	  print "$now\n$command\n";
+	  system("$command") == 0 or die "command failed: $!\n";
+	}
+      }
+    }
+  }
+}
+if (batch) {
+  close OUTPUT;
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/RBTree.pl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/RBTree.pl	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/RBTree.pl	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,103 @@
+#! /usr/bin/perl
+
+#############################################################################
+# syntax:
+# perl List.pl [manager] [adapter] [batch]
+# where
+#   [manager] is contention manager name
+#     if "all", run all known managers
+#     else run only "dstm2.manager.$manager.Manager";
+#   [adapter] is adapter name
+#     if "all", run all known adapters
+#     else run only "dstm2.factory.".$adapter.".Adapter"
+#   [batch] is whether to batch run
+#     if "batch", pipe output to unique file.
+#############################################################################
+
+require v5.6.0;
+use IO::Handle;
+
+#############################################################################
+# Test parameters and configuration
+#
+# $configfile defines $codedir, $prog, $numprocs and $machinedesc
+
+$configfile = './config.pl';
+require $configfile;
+
+# Benchmark program
+$benchmark = "RBTree";
+$benchmarkClass = "dstm2.benchmark.$benchmark";
+
+# Number of millisecond to run each benchmark
+$millis = 10000;
+
+###
+### Run the benchmark
+###
+
+$| = 1;				# flush stdout immediately after printf
+
+# Contention manager
+if (!$ARGV[0] || $ARGV[0] eq "all") {
+  @managers = (
+ 	       "Aggressive",
+ 	       "Backoff",
+ 	       "Eruption",
+	       "Greedy",
+ 	       "Karma",
+ 	       "Kindergarten",
+ 	       "Polka",
+ 	       "Priority"
+	      );
+} else {
+  @managers = (
+	       ucfirst($ARGV[0])
+	      );
+}
+
+if (!$ARGV[1] || $ARGV[1] eq "all") {
+  @adapters = (
+ 	       "ofree",
+# 	       "shadow",
+# 	       "shadow.invisible",
+# 	       "recycle",
+# 	       "recycle2",
+# 	       "rls",
+# 	       "twophase",
+	      );
+} else {
+  @adapters = (
+	       $ARGV[1],
+	      );
+}
+$batch = ($ARGV[2] eq "batch");
+if ($batch) {
+  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
+  $timestamp = sprintf "-%02d-%02d-%02d%02d%02d",$mon+1,$mday,$hour,$min,$sec;
+  $filename = "./$benchmark" . "-" . $ARGV[1] . "-" . $ENV{HOSTNAME} . $timestamp . ".raw";
+  print "writing to $filename\n";
+  open (OUTPUT, ">$filename") || die $!;
+  STDOUT->fdopen(\*OUTPUT, "w") || die $!;
+  STDERR->fdopen(\*OUTPUT, "w") || die $!;
+}
+
+chdir($codedir) or die "Invalid $codedir directory specified in $configfile.";
+
+foreach $m (@managers) {
+  $manager = "dstm2.manager.".$m."Manager";
+  foreach $eflag (100, 50, 0) {
+    foreach $thread (32, 16, 8, 4, 2, 1) {
+      foreach $a (@adapters) {
+	$adapter = "dstm2.factory.".$a.".Adapter";
+	$command = "$prog -m $manager -a $adapter -b $benchmarkClass -t $thread -n $millis -e $eflag";
+	my $now = localtime;
+	print "$now\n$command\n";
+	system("$command") == 0 or die "command failed: $!\n";
+      }
+    }
+  }
+}
+if (batch) {
+  close OUTPUT;
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Recycle.pl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Recycle.pl	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Recycle.pl	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,95 @@
+#! /usr/bin/perl
+
+  #############################################################################
+  # License and other legal information
+  #
+  # Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+  # Clara, California 95054, U.S.A.  All rights reserved
+  #
+  # Sun Microsystems, Inc. has intellectual property rights relating to
+  # technology embodied in the product that is described in this
+  # document.  In particular, and without limitation, these
+  # intellectual property rights may include one or more of the
+  # U.S. patents listed at http://www.sun.com/patents and one or more
+  # additional patents or pending patent applications in the U.S. and
+  # in other countries.
+  #
+  # U.S. Government Rights - Commercial software.
+  # Government users are subject to the Sun Microsystems, Inc. standard
+  # license agreement and applicable provisions of the FAR and its
+  # supplements.  Use is subject to license terms.  Sun, Sun
+  # Microsystems, the Sun logo and Java are trademarks or registered
+  # trademarks of Sun Microsystems, Inc. in the U.S. and other
+  # countries.
+  #
+  # This product is covered and controlled by U.S. Export Control laws
+  # and may be subject to the export or import laws in other countries.
+  # Nuclear, missile, chemical biological weapons or nuclear maritime
+  # end uses or end users, whether direct or indirect, are strictly
+  # prohibited.  Export or reexport to countries subject to
+  # U.S. embargo or to entities identified on U.S. export exclusion
+  # lists, including, but not limited to, the denied persons and
+  # specially designated nationals lists is strictly prohibited.
+
+  require v5.6.0;
+
+#############################################################################
+# Test parameters and configuration
+#
+# $configfile defines $codedir, $prog, $numprocs and $machinedesc
+
+$configfile = $ARGV[0] ? $ARGV[0] : './config.pl';
+require $configfile;
+
+# Benchmark program
+$benchmark = "dstm2.benchmark.List";
+
+# Contention manager
+
+# Number of millisecond to run each benchmark
+$millis =60000;
+
+###
+### Run the benchmark
+###
+
+# By assumption, the DSTM is already built and ready to run.
+$| = 1;				# flush stdout immediately after printf
+
+chdir($codedir) or die "Invalid dstm2 class directory specified in $configfile.";
+
+# Contention manager
+ at managers = (
+	     # 	     "Aggressive",
+	     # 	     "Greedy",
+	     # 	     "Karma",
+ 	     "Backoff",
+	     # 	     "Eruption",
+	     # 	     "Kindergarden",
+	     # 	     "Polka",
+	     # 	     "Priority",
+	    );
+
+ at adapters = (
+	     #	      "shadow",
+	     #	      "recycle",Desktop\
+	     #	     "ofree",
+	     "recycle",
+	     # 	      "ofree.invisible",
+	     # 	      "rls",
+	    );
+
+foreach $m (@managers) {
+  $manager = "dstm2.manager.".$m."Manager";
+  foreach $eflag (100, 50, 0) {
+    foreach $thread (32, 16, 8, 4, 2, 1) {
+      foreach $a (@adapters) {
+	$adapter = "dstm2.factory.".$a.".Adapter";
+	$command = "$prog -m $manager -a $adapter -b $benchmark -t $thread -n $millis -e $eflag";
+	my $now = localtime;
+	print "$now\n$command\n";
+	system("$command") == 0 or die "command failed: $!\n";
+      }
+    }
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Recyle.pl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Recyle.pl	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Recyle.pl	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,95 @@
+#! /usr/bin/perl
+
+  #############################################################################
+  # License and other legal information
+  #
+  # Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+  # Clara, California 95054, U.S.A.  All rights reserved
+  #
+  # Sun Microsystems, Inc. has intellectual property rights relating to
+  # technology embodied in the product that is described in this
+  # document.  In particular, and without limitation, these
+  # intellectual property rights may include one or more of the
+  # U.S. patents listed at http://www.sun.com/patents and one or more
+  # additional patents or pending patent applications in the U.S. and
+  # in other countries.
+  #
+  # U.S. Government Rights - Commercial software.
+  # Government users are subject to the Sun Microsystems, Inc. standard
+  # license agreement and applicable provisions of the FAR and its
+  # supplements.  Use is subject to license terms.  Sun, Sun
+  # Microsystems, the Sun logo and Java are trademarks or registered
+  # trademarks of Sun Microsystems, Inc. in the U.S. and other
+  # countries.
+  #
+  # This product is covered and controlled by U.S. Export Control laws
+  # and may be subject to the export or import laws in other countries.
+  # Nuclear, missile, chemical biological weapons or nuclear maritime
+  # end uses or end users, whether direct or indirect, are strictly
+  # prohibited.  Export or reexport to countries subject to
+  # U.S. embargo or to entities identified on U.S. export exclusion
+  # lists, including, but not limited to, the denied persons and
+  # specially designated nationals lists is strictly prohibited.
+
+  require v5.6.0;
+
+#############################################################################
+# Test parameters and configuration
+#
+# $configfile defines $codedir, $prog, $numprocs and $machinedesc
+
+$configfile = $ARGV[0] ? $ARGV[0] : './config.pl';
+require $configfile;
+
+# Benchmark program
+$benchmark = "dstm2.benchmark.List";
+
+# Contention manager
+
+# Number of millisecond to run each benchmark
+$millis =60000;
+
+###
+### Run the benchmark
+###
+
+# By assumption, the DSTM is already built and ready to run.
+$| = 1;				# flush stdout immediately after printf
+
+chdir($codedir) or die "Invalid dstm2 class directory specified in $configfile.";
+
+# Contention manager
+ at managers = (
+	     # 	     "Aggressive",
+	     # 	     "Greedy",
+	     # 	     "Karma",
+ 	     "Backoff",
+	     # 	     "Eruption",
+	     # 	     "Kindergarden",
+	     # 	     "Polka",
+	     # 	     "Priority",
+	    );
+
+ at adapters = (
+	     #	      "shadow",
+	     #	      "recycle",Desktop\
+	     #	     "ofree",
+	     "recycle",
+	     # 	      "ofree.invisible",
+	     # 	      "rls",
+	    );
+
+foreach $m (@managers) {
+  $manager = "dstm2.manager.".$m."Manager";
+  foreach $eflag (100, 50, 0) {
+    foreach $thread (32, 16, 8, 4, 2, 1) {
+      foreach $a (@adapters) {
+	$adapter = "dstm2.factory.".$a.".Adapter";
+	$command = "$prog -m $manager -a $adapter -b $benchmark -t $thread -n $millis -e $eflag";
+	my $now = localtime;
+	print "$now\n$command\n";
+	system("$command") == 0 or die "command failed: $!\n";
+      }
+    }
+  }
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/SkipList.pl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/SkipList.pl	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/SkipList.pl	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,108 @@
+#! /usr/bin/perl
+
+#############################################################################
+# syntax:
+# perl List.pl [manager] [adapter] [batch]
+# where
+#   [manager] is contention manager name
+#     if "all", run all known managers
+#     else run only "dstm2.manager.$manager.Manager";
+#   [adapter] is adapter name
+#     if "all", run all known adapters
+#     else run only "dstm2.factory.".$adapter.".Adapter"
+#   [batch] is whether to batch run
+#     if "batch", pipe output to unique file.
+#############################################################################
+
+require v5.6.0;
+use IO::Handle;
+
+#############################################################################
+# Test parameters and configuration
+#
+# $configfile defines $codedir, $prog, $numprocs and $machinedesc
+
+$configfile = './config.pl';
+require $configfile;
+
+# Benchmark program
+$benchmark = "SkipListBenchmark";
+$benchmarkClass = "dstm2.benchmark.$benchmark";
+
+# Number of millisecond to run each benchmark
+$millis = 10000;
+
+###
+### Run the benchmark
+###
+
+$| = 1;				# flush stdout immediately after printf
+
+# Contention manager
+if (!$ARGV[0] || $ARGV[0] eq "all") {
+  @managers = (
+ 	       "Aggressive",
+ 	       "Backoff",
+ 	       "Eruption",
+	       "Greedy",
+ 	       "Karma",
+ 	       "Kindergarten",
+ 	       "Polka",
+ 	       "Priority"
+	      );
+} else {
+  @managers = (
+	       ucfirst($ARGV[0])
+	      );
+}
+
+if (!$ARGV[1] || $ARGV[1] eq "all") {
+  @adapters = (
+ 	       "ofree",
+ 	       "shadow",
+ 	       "shadow.invisible",
+ 	       "recycle",
+ 	       "twophase",
+	      );
+} else {
+  @adapters = (
+	       $ARGV[1],
+	      );
+}
+$batch = ($ARGV[2] eq "batch");
+if ($batch) {
+  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
+  $timestamp = sprintf "-%02d-%02d-%02d%02d%02d",$mon+1,$mday,$hour,$min,$sec;
+  $filename = "./$benchmark" . "-" . $ARGV[1] . "-" . $ENV{HOSTNAME} . $timestamp . ".raw";
+  print "writing to $filename\n";
+  open (OUTPUT, ">$filename") || die $!;
+  STDOUT->fdopen(\*OUTPUT, "w") || die $!;
+  STDERR->fdopen(\*OUTPUT, "w") || die $!;
+}
+
+chdir($codedir) or die "Invalid $codedir directory specified in $configfile.";
+
+foreach $m (@managers) {
+  $manager = "dstm2.manager.".$m."Manager";
+  foreach $eflag (100, 50, 0) {
+    foreach $thread (32, 16, 8, 4, 2, 1) {
+      foreach $a (@adapters) {
+	$adapter = "dstm2.factory.".$a.".Adapter";
+	$command = "$prog -m $manager -a $adapter -b $benchmarkClass -t $thread -n $millis -e $eflag";
+	my $now = localtime;
+	print "$now\n$command\n";
+	system("$command") == 0 or die "command failed: $!\n";
+      }
+      $manager = "dstm2.manager.NullManager";
+      $adapter = "dstm2.factory.ofree.Adapter";
+      $benchmarkClass = "dstm2.benchmark.boosting.$benchmark";
+      $command = "$prog -m $manager -a $adapter -b $benchmarkClass -t $thread -n $millis -e $eflag";
+      my $now = localtime;
+      print "$now\n$command\n";
+      system("$command") == 0 or die "command failed: $!\n";
+    }
+  }
+}
+if (batch) {
+  close OUTPUT;
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Test.pl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Test.pl	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/Test.pl	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,102 @@
+#! /usr/bin/perl
+
+#############################################################################
+# syntax:
+# perl List.pl [manager] [adapter] [batch]
+# where
+#   [manager] is contention manager name
+#     if "all", run all known managers
+#     else run only "dstm2.manager.$manager.Manager";
+#   [adapter] is adapter name
+#     if "all", run all known adapters
+#     else run only "dstm2.factory.".$adapter.".Adapter"
+#   [batch] is whether to batch run
+#     if "batch", pipe output to unique file.
+#############################################################################
+
+require v5.6.0;
+use IO::Handle;
+
+#############################################################################
+# Test parameters and configuration
+#
+# $configfile defines $codedir, $prog, $numprocs and $machinedesc
+
+$configfile = './config.pl';
+require $configfile;
+
+# Benchmark program
+$benchmark = "SkipListBenchmark";
+
+# Number of millisecond to run each benchmark
+$millis = 10000;
+
+###
+### Run the benchmark
+###
+
+$| = 1;				# flush stdout immediately after printf
+
+# Contention manager
+if (!$ARGV[0] || $ARGV[0] eq "all") {
+  @managers = (
+ 	       "Aggressive",
+ 	       "Backoff",
+ 	       "Eruption",
+	       "Greedy",
+ 	       "Karma",
+ 	       "Kindergarten",
+ 	       "Polka",
+ 	       "Priority"
+	      );
+} else {
+  @managers = (
+	       ucfirst($ARGV[0])
+	      );
+}
+
+if (!$ARGV[1] || $ARGV[1] eq "all") {
+  @adapters = (
+ 	       "ofree",
+# 	       "shadow",
+# 	       "shadow.invisible",
+# 	       "recycle",
+# 	       "recycle2",
+# 	       "rls",
+# 	       "twophase",
+	      );
+} else {
+  @adapters = (
+	       $ARGV[1],
+	      );
+}
+$batch = ($ARGV[2] eq "batch");
+if ($batch) {
+  ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
+  $timestamp = sprintf "-%02d-%02d-%02d%02d%02d",$mon+1,$mday,$hour,$min,$sec;
+  $filename = "./$benchmark" . "-" . $ARGV[1] . "-" . $ENV{HOSTNAME} . $timestamp . ".raw";
+  print "writing to $filename\n";
+  open (OUTPUT, ">$filename") || die $!;
+  STDOUT->fdopen(\*OUTPUT, "w") || die $!;
+  STDERR->fdopen(\*OUTPUT, "w") || die $!;
+}
+
+chdir($codedir) or die "Invalid $codedir directory specified in $configfile.";
+
+foreach $m (@managers) {
+  $manager = "dstm2.manager.".$m."Manager";
+  foreach $eflag (100, 50, 0) {
+    foreach $thread (32, 16, 8, 4, 2, 1) {
+      $manager = "dstm2.manager.NullManager";
+      $adapter = "dstm2.factory.ofree.Adapter";
+      $benchmarkClass = "dstm2.benchmark.boosting.$benchmark";
+      $command = "$prog -m $manager -a $adapter -b $benchmarkClass -t $thread -n $millis -e $eflag";
+      my $now = localtime;
+      print "$now\n$command\n";
+      system("$command") == 0 or die "command failed: $!\n";
+    }
+  }
+}
+if (batch) {
+  close OUTPUT;
+}

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/bench.sh
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/bench.sh	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/bench.sh	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+export CLASSPATH=$CLASSPATH:./:$CUR_PATH/bcel/bcel-5.2.jar
+echo $CLASSPATH
+
+CUR_PATH=`pwd`
+DURATION=5000
+
+if [ $1 ] ; then
+    DATE=$1
+else
+    DATE=`date +%y%m%d.%H%M`
+fi
+
+#TODO see if seq command exists on Solaris
+
+for adapter in "dstm2.factory.ofree.Adapter" "dstm2.factory.shadow.Adapter"
+do
+	echo "adapter: $adapter"
+	
+	for bench in "dstm2.benchmark.SkipList" # "dstm2.benchmark.RBTree"
+	do
+		echo "  bench: $bench"
+		for update in 0 20 50 # 100
+		do
+			echo "    update: $update"
+			for thread in 01 02 04 08 16
+			do
+				echo "      thread: $thread"
+				BENCH_DIR=$CUR_PATH/$DATE-$bench-u$update
+
+				mkdir -p $BENCH_DIR
+				# if file exists skip execution
+				if [ -f $BENCH_DIR/$adapter-$thread.log ] ; then
+				    echo "        Skip execution"
+				else
+
+				for run in 1 2
+				do
+					echo "        run: $run"
+					java dstm2.Main -b $bench -a $adapter -t $thread -n $DURATION -e $update >> $BENCH_DIR/$adapter-$thread.log
+				done
+
+				fi
+
+			done
+		done
+	
+	done
+	
+done
+
+
+
+
+
+

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/benchmark-ListBenchmark-all-ofree-towhee-07-30-233204.raw
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/benchmark-ListBenchmark-all-ofree-towhee-07-30-233204.raw	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/benchmark-ListBenchmark-all-ofree-towhee-07-30-233204.raw	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,413 @@
+-->ListBenchmark
+Wed Jul 30 23:32:04 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 32 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 100% updates
+Integer Set OK
+Committed: 1570
+Total: 2293140
+Percent committed: (0%)
+Insert/Remove calls:	1570
+Contains calls:	0
+Elapsed time: 10.14 seconds.
+----------------------------------------
+Wed Jul 30 23:32:15 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 16 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 100% updates
+Integer Set OK
+Committed: 1552
+Total: 2313074
+Percent committed: (0%)
+Insert/Remove calls:	1552
+Contains calls:	0
+Elapsed time: 10.063 seconds.
+----------------------------------------
+Wed Jul 30 23:32:26 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 8 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 100% updates
+Integer Set OK
+Committed: 2517
+Total: 2251868
+Percent committed: (0%)
+Insert/Remove calls:	2517
+Contains calls:	0
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:32:37 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 4 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 100% updates
+Integer Set OK
+Committed: 2951
+Total: 2342500
+Percent committed: (0%)
+Insert/Remove calls:	2951
+Contains calls:	0
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:32:48 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 2 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 100% updates
+Integer Set OK
+Committed: 5855
+Total: 2443862
+Percent committed: (0%)
+Insert/Remove calls:	5855
+Contains calls:	0
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:32:59 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 1 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 100% updates
+Integer Set OK
+Committed: 174711
+Total: 174711
+Percent committed: (100%)
+Insert/Remove calls:	174711
+Contains calls:	0
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:33:10 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 32 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 50% updates
+Integer Set OK
+Committed: 1781
+Total: 2183022
+Percent committed: (0%)
+Insert/Remove calls:	903
+Contains calls:	878
+Elapsed time: 10.015 seconds.
+----------------------------------------
+Wed Jul 30 23:33:21 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 16 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 50% updates
+Integer Set OK
+Committed: 1959
+Total: 2333439
+Percent committed: (0%)
+Insert/Remove calls:	993
+Contains calls:	966
+Elapsed time: 10.031 seconds.
+----------------------------------------
+Wed Jul 30 23:33:31 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 8 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 50% updates
+Integer Set OK
+Committed: 3263
+Total: 2251665
+Percent committed: (0%)
+Insert/Remove calls:	1602
+Contains calls:	1661
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Wed Jul 30 23:33:42 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 4 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 50% updates
+Integer Set OK
+Committed: 3301
+Total: 2393142
+Percent committed: (0%)
+Insert/Remove calls:	1624
+Contains calls:	1677
+Elapsed time: 10.015 seconds.
+----------------------------------------
+Wed Jul 30 23:33:53 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 2 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 50% updates
+Integer Set OK
+Committed: 7016
+Total: 2454182
+Percent committed: (0%)
+Insert/Remove calls:	3471
+Contains calls:	3545
+Elapsed time: 10.015 seconds.
+----------------------------------------
+Wed Jul 30 23:34:04 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 1 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 50% updates
+Integer Set OK
+Committed: 185804
+Total: 185804
+Percent committed: (100%)
+Insert/Remove calls:	93185
+Contains calls:	92619
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:34:15 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 32 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 0% updates
+Integer Set OK
+Committed: 100280
+Total: 2418567
+Percent committed: (4%)
+Insert/Remove calls:	0
+Contains calls:	100280
+Elapsed time: 10.015 seconds.
+----------------------------------------
+Wed Jul 30 23:34:26 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 16 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 0% updates
+Integer Set OK
+Committed: 127716
+Total: 2540440
+Percent committed: (5%)
+Insert/Remove calls:	0
+Contains calls:	127716
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:34:37 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 8 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 0% updates
+Integer Set OK
+Committed: 205263
+Total: 2646546
+Percent committed: (7%)
+Insert/Remove calls:	0
+Contains calls:	205263
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Wed Jul 30 23:34:48 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 4 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 0% updates
+Integer Set OK
+Committed: 126775
+Total: 2497697
+Percent committed: (5%)
+Insert/Remove calls:	0
+Contains calls:	126775
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Wed Jul 30 23:34:58 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 2 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 0% updates
+Integer Set OK
+Committed: 255340
+Total: 2785172
+Percent committed: (9%)
+Insert/Remove calls:	0
+Contains calls:	255340
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Wed Jul 30 23:35:09 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 1 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 0% updates
+Integer Set OK
+Committed: 1239238
+Total: 1239238
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	1239238
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:35:20 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.BackoffManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 32 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.BackoffManager
+Threads: 32
+Mix: 100% updates
+Integer Set OK
+Committed: 12021
+Total: 12736
+Percent committed: (94%)
+Insert/Remove calls:	12021
+Contains calls:	0
+Elapsed time: 10.391 seconds.
+----------------------------------------
+Wed Jul 30 23:35:32 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.BackoffManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 16 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.BackoffManager
+Threads: 16
+Mix: 100% updates
+Integer Set OK
+Committed: 14674
+Total: 15372
+Percent committed: (95%)
+Insert/Remove calls:	14674
+Contains calls:	0
+Elapsed time: 10.297 seconds.
+----------------------------------------
+Wed Jul 30 23:35:43 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.BackoffManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 8 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.BackoffManager
+Threads: 8
+Mix: 100% updates
+Integer Set OK
+Committed: 23505
+Total: 24189
+Percent committed: (97%)
+Insert/Remove calls:	23505
+Contains calls:	0
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Wed Jul 30 23:35:54 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.BackoffManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 4 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.BackoffManager
+Threads: 4
+Mix: 100% updates
+Integer Set OK
+Committed: 42879
+Total: 43478
+Percent committed: (98%)
+Insert/Remove calls:	42879
+Contains calls:	0
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Wed Jul 30 23:36:05 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.BackoffManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 2 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.BackoffManager
+Threads: 2
+Mix: 100% updates
+Integer Set OK
+Committed: 74203
+Total: 74214
+Percent committed: (99%)
+Insert/Remove calls:	74203
+Contains calls:	0
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Wed Jul 30 23:36:15 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.BackoffManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 1 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.BackoffManager
+Threads: 1
+Mix: 100% updates
+Integer Set OK
+Committed: 185037
+Total: 185037
+Percent committed: (100%)
+Insert/Remove calls:	185037
+Contains calls:	0
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:36:26 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.BackoffManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 32 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.BackoffManager
+Threads: 32
+Mix: 50% updates
+Integer Set OK
+Committed: 13568
+Total: 14036
+Percent committed: (96%)
+Insert/Remove calls:	6835
+Contains calls:	6733
+Elapsed time: 10.343 seconds.
+----------------------------------------
+Wed Jul 30 23:36:38 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.BackoffManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 16 -n 10000 -e 50
+java.lang.NoClassDefFoundError: dstm2/Main
+Caused by: java.lang.ClassNotFoundException: dstm2.Main
+	at java.net.URLClassLoader$1.run(Unknown Source)
+	at java.security.AccessController.doPrivileged(Native Method)
+	at java.net.URLClassLoader.findClass(Unknown Source)
+	at java.lang.ClassLoader.loadClass(Unknown Source)
+	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
+	at java.lang.ClassLoader.loadClass(Unknown Source)
+	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
+Exception in thread "main" command failed: 

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/benchmark-ListBenchmark-all-shadow-towhee-07-30-234642.raw
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/benchmark-ListBenchmark-all-shadow-towhee-07-30-234642.raw	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/benchmark-ListBenchmark-all-shadow-towhee-07-30-234642.raw	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,297 @@
+-->ListBenchmark
+Wed Jul 30 23:46:42 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 32 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 100% updates
+Integer Set OK
+Committed: 29334
+Total: 47848
+Percent committed: (61%)
+Insert/Remove calls:	29334
+Contains calls:	0
+Elapsed time: 10.11 seconds.
+----------------------------------------
+Wed Jul 30 23:46:53 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 16 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 100% updates
+Integer Set OK
+Committed: 58454
+Total: 73017
+Percent committed: (80%)
+Insert/Remove calls:	58454
+Contains calls:	0
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Wed Jul 30 23:47:04 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 8 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 100% updates
+Integer Set OK
+Committed: 90213
+Total: 110703
+Percent committed: (81%)
+Insert/Remove calls:	90213
+Contains calls:	0
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:47:15 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 4 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 100% updates
+Integer Set OK
+Committed: 132100
+Total: 158860
+Percent committed: (83%)
+Insert/Remove calls:	132100
+Contains calls:	0
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Wed Jul 30 23:47:26 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 2 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 100% updates
+Integer Set OK
+Committed: 202499
+Total: 242057
+Percent committed: (83%)
+Insert/Remove calls:	202499
+Contains calls:	0
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:47:37 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 1 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 100% updates
+Integer Set OK
+Committed: 216428
+Total: 216428
+Percent committed: (100%)
+Insert/Remove calls:	216428
+Contains calls:	0
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:47:48 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 32 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 50% updates
+Integer Set OK
+Committed: 46412
+Total: 58761
+Percent committed: (78%)
+Insert/Remove calls:	23130
+Contains calls:	23282
+Elapsed time: 10.156 seconds.
+----------------------------------------
+Wed Jul 30 23:47:59 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 16 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 50% updates
+Integer Set OK
+Committed: 70826
+Total: 83786
+Percent committed: (84%)
+Insert/Remove calls:	35508
+Contains calls:	35318
+Elapsed time: 10.031 seconds.
+----------------------------------------
+Wed Jul 30 23:48:10 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 8 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 50% updates
+Integer Set OK
+Committed: 113265
+Total: 131254
+Percent committed: (86%)
+Insert/Remove calls:	56420
+Contains calls:	56845
+Elapsed time: 10.015 seconds.
+----------------------------------------
+Wed Jul 30 23:48:20 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 4 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 50% updates
+Integer Set OK
+Committed: 157123
+Total: 175087
+Percent committed: (89%)
+Insert/Remove calls:	78720
+Contains calls:	78403
+Elapsed time: 10.031 seconds.
+----------------------------------------
+Wed Jul 30 23:48:31 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 2 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 50% updates
+Integer Set OK
+Committed: 240810
+Total: 265346
+Percent committed: (90%)
+Insert/Remove calls:	120788
+Contains calls:	120022
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:48:42 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 1 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 50% updates
+Integer Set OK
+Committed: 229285
+Total: 229285
+Percent committed: (100%)
+Insert/Remove calls:	114240
+Contains calls:	115045
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:48:53 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 32 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 0% updates
+Integer Set OK
+Committed: 1427913
+Total: 1427913
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	1427913
+Elapsed time: 10.063 seconds.
+----------------------------------------
+Wed Jul 30 23:49:04 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 16 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 0% updates
+Integer Set OK
+Committed: 1314397
+Total: 1314397
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	1314397
+Elapsed time: 10.015 seconds.
+----------------------------------------
+Wed Jul 30 23:49:15 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 8 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 0% updates
+Integer Set OK
+Committed: 1284537
+Total: 1284537
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	1284537
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:49:26 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 4 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 0% updates
+Integer Set OK
+Committed: 1365306
+Total: 1365306
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	1365306
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Wed Jul 30 23:49:37 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 2 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 0% updates
+Integer Set OK
+Committed: 1532832
+Total: 1532832
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	1532832
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:49:48 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 1 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 0% updates
+Integer Set OK
+Committed: 1275216
+Total: 1275216
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	1275216
+Elapsed time: 10.0 seconds.
+----------------------------------------
+Wed Jul 30 23:49:58 2008
+"c:\WINDOWS\system32\java" -classpath "dstm2.1.jar;c:\Documents and Settings\mph\My Documents\dstm2.1-beta\bcel\bcel-5.2.jar" dstm2.Main -m dstm2.manager.BackoffManager -a dstm2.factory.shadow.Adapter -b dstm2.benchmark.ListBenchmark -t 32 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.shadow.Adapter
+Contention manager: dstm2.manager.BackoffManager
+Threads: 32
+Mix: 100% updates

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/benchmark-all-aggressive-ofree-oriole-07-21-125113.raw
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/benchmark-all-aggressive-ofree-oriole-07-21-125113.raw	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/benchmark-all-aggressive-ofree-oriole-07-21-125113.raw	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,1445 @@
+-->RBTreeBenchmark
+Mon Jul 21 12:51:13 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 32 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 100% updates
+Integer Set OK
+Committed: 1071
+Total: 1415503
+Percent committed: (0%)
+Insert/Remove calls:	1071
+Contains calls:	0
+Elapsed time: 10.804 seconds.
+----------------------------------------
+Mon Jul 21 12:51:26 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 16 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 100% updates
+Integer Set OK
+Committed: 962
+Total: 1361263
+Percent committed: (0%)
+Insert/Remove calls:	962
+Contains calls:	0
+Elapsed time: 10.305 seconds.
+----------------------------------------
+Mon Jul 21 12:51:37 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 8 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 100% updates
+Integer Set OK
+Committed: 309
+Total: 2526784
+Percent committed: (0%)
+Insert/Remove calls:	309
+Contains calls:	0
+Elapsed time: 10.015 seconds.
+----------------------------------------
+Mon Jul 21 12:51:47 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 4 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 100% updates
+Integer Set OK
+Committed: 609
+Total: 2855396
+Percent committed: (0%)
+Insert/Remove calls:	609
+Contains calls:	0
+Elapsed time: 10.005 seconds.
+----------------------------------------
+Mon Jul 21 12:51:58 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 2 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 100% updates
+Integer Set OK
+Committed: 500
+Total: 2355276
+Percent committed: (0%)
+Insert/Remove calls:	500
+Contains calls:	0
+Elapsed time: 10.008 seconds.
+----------------------------------------
+Mon Jul 21 12:52:08 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 1 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 100% updates
+Integer Set OK
+Committed: 246232
+Total: 246232
+Percent committed: (100%)
+Insert/Remove calls:	246232
+Contains calls:	0
+Elapsed time: 10.006 seconds.
+----------------------------------------
+Mon Jul 21 12:52:19 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 32 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 50% updates
+Integer Set OK
+Committed: 2292
+Total: 1616988
+Percent committed: (0%)
+Insert/Remove calls:	1116
+Contains calls:	1176
+Elapsed time: 10.551 seconds.
+----------------------------------------
+Mon Jul 21 12:52:31 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 16 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 50% updates
+Integer Set OK
+Committed: 1638
+Total: 1293491
+Percent committed: (0%)
+Insert/Remove calls:	812
+Contains calls:	826
+Elapsed time: 10.266 seconds.
+----------------------------------------
+Mon Jul 21 12:52:41 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 8 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 50% updates
+Integer Set OK
+Committed: 981
+Total: 1677651
+Percent committed: (0%)
+Insert/Remove calls:	497
+Contains calls:	484
+Elapsed time: 10.05 seconds.
+----------------------------------------
+Mon Jul 21 12:52:52 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 4 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 50% updates
+Integer Set OK
+Committed: 958
+Total: 2446119
+Percent committed: (0%)
+Insert/Remove calls:	482
+Contains calls:	476
+Elapsed time: 10.007 seconds.
+----------------------------------------
+Mon Jul 21 12:53:03 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 2 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 50% updates
+Integer Set OK
+Committed: 1741
+Total: 2471438
+Percent committed: (0%)
+Insert/Remove calls:	885
+Contains calls:	856
+Elapsed time: 10.004 seconds.
+----------------------------------------
+Mon Jul 21 12:53:14 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 1 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 50% updates
+Integer Set OK
+Committed: 365354
+Total: 365354
+Percent committed: (100%)
+Insert/Remove calls:	182105
+Contains calls:	183249
+Elapsed time: 10.004 seconds.
+----------------------------------------
+Mon Jul 21 12:53:24 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 32 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 0% updates
+Integer Set OK
+Committed: 12244
+Total: 1355081
+Percent committed: (0%)
+Insert/Remove calls:	0
+Contains calls:	12244
+Elapsed time: 10.695 seconds.
+----------------------------------------
+Mon Jul 21 12:53:35 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 16 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 0% updates
+Integer Set OK
+Committed: 8798
+Total: 2719689
+Percent committed: (0%)
+Insert/Remove calls:	0
+Contains calls:	8798
+Elapsed time: 10.465 seconds.
+----------------------------------------
+Mon Jul 21 12:53:47 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 8 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 0% updates
+Integer Set OK
+Committed: 194
+Total: 2593754
+Percent committed: (0%)
+Insert/Remove calls:	0
+Contains calls:	194
+Elapsed time: 10.173 seconds.
+----------------------------------------
+Mon Jul 21 12:53:57 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 4 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 0% updates
+Integer Set OK
+Committed: 92
+Total: 3010294
+Percent committed: (0%)
+Insert/Remove calls:	0
+Contains calls:	92
+Elapsed time: 10.013 seconds.
+----------------------------------------
+Mon Jul 21 12:54:08 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 2 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 0% updates
+Integer Set OK
+Committed: 8639
+Total: 2536114
+Percent committed: (0%)
+Insert/Remove calls:	0
+Contains calls:	8639
+Elapsed time: 10.005 seconds.
+----------------------------------------
+Mon Jul 21 12:54:19 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.RBTreeBenchmark -t 1 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.RBTreeBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 0% updates
+Integer Set OK
+Committed: 2681383
+Total: 2681383
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	2681383
+Elapsed time: 10.004 seconds.
+----------------------------------------
+-->ListBenchmark
+Mon Jul 21 12:54:29 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 32 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 100% updates
+Integer Set OK
+Committed: 805
+Total: 1442997
+Percent committed: (0%)
+Insert/Remove calls:	805
+Contains calls:	0
+Elapsed time: 10.223 seconds.
+----------------------------------------
+Mon Jul 21 12:54:40 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 16 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 100% updates
+Integer Set OK
+Committed: 2699
+Total: 2785985
+Percent committed: (0%)
+Insert/Remove calls:	2699
+Contains calls:	0
+Elapsed time: 10.815 seconds.
+----------------------------------------
+Mon Jul 21 12:54:51 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 8 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 100% updates
+Integer Set OK
+Committed: 4
+Total: 2736938
+Percent committed: (0%)
+Insert/Remove calls:	4
+Contains calls:	0
+Elapsed time: 10.062 seconds.
+----------------------------------------
+Mon Jul 21 12:55:02 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 4 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 100% updates
+Integer Set OK
+Committed: 5
+Total: 3100098
+Percent committed: (0%)
+Insert/Remove calls:	5
+Contains calls:	0
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Mon Jul 21 12:55:13 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 2 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 100% updates
+Integer Set OK
+Committed: 90
+Total: 2608489
+Percent committed: (0%)
+Insert/Remove calls:	90
+Contains calls:	0
+Elapsed time: 10.007 seconds.
+----------------------------------------
+Mon Jul 21 12:55:24 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 1 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 100% updates
+Integer Set OK
+Committed: 354774
+Total: 354774
+Percent committed: (100%)
+Insert/Remove calls:	354774
+Contains calls:	0
+Elapsed time: 10.004 seconds.
+----------------------------------------
+Mon Jul 21 12:55:34 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 32 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 50% updates
+Integer Set OK
+Committed: 1409
+Total: 2221110
+Percent committed: (0%)
+Insert/Remove calls:	744
+Contains calls:	665
+Elapsed time: 10.151 seconds.
+----------------------------------------
+Mon Jul 21 12:55:45 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 16 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 50% updates
+Integer Set OK
+Committed: 854
+Total: 2739764
+Percent committed: (0%)
+Insert/Remove calls:	439
+Contains calls:	415
+Elapsed time: 10.683 seconds.
+----------------------------------------
+Mon Jul 21 12:55:56 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 8 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 50% updates
+Integer Set OK
+Committed: 19
+Total: 2850357
+Percent committed: (0%)
+Insert/Remove calls:	10
+Contains calls:	9
+Elapsed time: 10.047 seconds.
+----------------------------------------
+Mon Jul 21 12:56:07 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 4 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 50% updates
+Integer Set OK
+Committed: 25
+Total: 2784030
+Percent committed: (0%)
+Insert/Remove calls:	13
+Contains calls:	12
+Elapsed time: 10.009 seconds.
+----------------------------------------
+Mon Jul 21 12:56:17 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 2 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 50% updates
+Integer Set OK
+Committed: 152
+Total: 2597273
+Percent committed: (0%)
+Insert/Remove calls:	71
+Contains calls:	81
+Elapsed time: 10.007 seconds.
+----------------------------------------
+Mon Jul 21 12:56:28 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 1 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 50% updates
+Integer Set OK
+Committed: 357212
+Total: 357212
+Percent committed: (100%)
+Insert/Remove calls:	178103
+Contains calls:	179109
+Elapsed time: 10.009 seconds.
+----------------------------------------
+Mon Jul 21 12:56:39 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 32 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 0% updates
+Integer Set OK
+Committed: 53102
+Total: 1896084
+Percent committed: (2%)
+Insert/Remove calls:	0
+Contains calls:	53102
+Elapsed time: 10.747 seconds.
+----------------------------------------
+Mon Jul 21 12:56:50 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 16 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 0% updates
+Integer Set OK
+Committed: 25589
+Total: 2637797
+Percent committed: (0%)
+Insert/Remove calls:	0
+Contains calls:	25589
+Elapsed time: 10.078 seconds.
+----------------------------------------
+Mon Jul 21 12:57:01 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 8 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 0% updates
+Integer Set OK
+Committed: 52
+Total: 2696924
+Percent committed: (0%)
+Insert/Remove calls:	0
+Contains calls:	52
+Elapsed time: 10.028 seconds.
+----------------------------------------
+Mon Jul 21 12:57:12 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 4 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 0% updates
+Integer Set OK
+Committed: 984
+Total: 2599929
+Percent committed: (0%)
+Insert/Remove calls:	0
+Contains calls:	984
+Elapsed time: 10.008 seconds.
+----------------------------------------
+Mon Jul 21 12:57:22 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 2 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 0% updates
+Integer Set OK
+Committed: 24696
+Total: 2445290
+Percent committed: (1%)
+Insert/Remove calls:	0
+Contains calls:	24696
+Elapsed time: 10.001 seconds.
+----------------------------------------
+Mon Jul 21 12:57:32 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.ListBenchmark -t 1 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 0% updates
+Integer Set OK
+Committed: 4219214
+Total: 4219214
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	4219214
+Elapsed time: 10.006 seconds.
+----------------------------------------
+-->SkipListBenchmark
+Mon Jul 21 12:57:43 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 32 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 100% updates
+Integer Set OK
+Committed: 470171
+Total: 470172
+Percent committed: (99%)
+Insert/Remove calls:	470171
+Contains calls:	0
+Elapsed time: 10.029 seconds.
+----------------------------------------
+Mon Jul 21 12:57:53 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 16 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 100% updates
+Integer Set OK
+Committed: 473492
+Total: 473505
+Percent committed: (99%)
+Insert/Remove calls:	473492
+Contains calls:	0
+Elapsed time: 10.015 seconds.
+----------------------------------------
+Mon Jul 21 12:58:04 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 8 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 100% updates
+Integer Set OK
+Committed: 506368
+Total: 506368
+Percent committed: (100%)
+Insert/Remove calls:	506368
+Contains calls:	0
+Elapsed time: 10.01 seconds.
+----------------------------------------
+Mon Jul 21 12:58:15 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 4 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 100% updates
+Integer Set OK
+Committed: 528392
+Total: 528392
+Percent committed: (100%)
+Insert/Remove calls:	528392
+Contains calls:	0
+Elapsed time: 10.005 seconds.
+----------------------------------------
+Mon Jul 21 12:58:25 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 2 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 100% updates
+Integer Set OK
+Committed: 499540
+Total: 499540
+Percent committed: (100%)
+Insert/Remove calls:	499540
+Contains calls:	0
+Elapsed time: 10.007 seconds.
+----------------------------------------
+Mon Jul 21 12:58:36 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 1 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 100% updates
+Integer Set OK
+Committed: 834996
+Total: 834996
+Percent committed: (100%)
+Insert/Remove calls:	834996
+Contains calls:	0
+Elapsed time: 10.007 seconds.
+----------------------------------------
+Mon Jul 21 12:58:46 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 32 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 50% updates
+Integer Set OK
+Committed: 497120
+Total: 497120
+Percent committed: (100%)
+Insert/Remove calls:	248563
+Contains calls:	248557
+Elapsed time: 10.021 seconds.
+----------------------------------------
+Mon Jul 21 12:58:57 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 16 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 50% updates
+Integer Set OK
+Committed: 500751
+Total: 500751
+Percent committed: (100%)
+Insert/Remove calls:	250191
+Contains calls:	250560
+Elapsed time: 10.01 seconds.
+----------------------------------------
+Mon Jul 21 12:59:08 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 8 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 50% updates
+Integer Set OK
+Committed: 481476
+Total: 481476
+Percent committed: (100%)
+Insert/Remove calls:	240890
+Contains calls:	240586
+Elapsed time: 10.009 seconds.
+----------------------------------------
+Mon Jul 21 12:59:18 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 4 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 50% updates
+Integer Set OK
+Committed: 541928
+Total: 541928
+Percent committed: (100%)
+Insert/Remove calls:	270826
+Contains calls:	271102
+Elapsed time: 10.005 seconds.
+----------------------------------------
+Mon Jul 21 12:59:28 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 2 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 50% updates
+Integer Set OK
+Committed: 490222
+Total: 490222
+Percent committed: (100%)
+Insert/Remove calls:	245275
+Contains calls:	244947
+Elapsed time: 10.007 seconds.
+----------------------------------------
+Mon Jul 21 12:59:39 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 1 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 50% updates
+Integer Set OK
+Committed: 821025
+Total: 821025
+Percent committed: (100%)
+Insert/Remove calls:	410165
+Contains calls:	410860
+Elapsed time: 10.006 seconds.
+----------------------------------------
+Mon Jul 21 12:59:50 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 32 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 0% updates
+Integer Set OK
+Committed: 1123716
+Total: 1123716
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	1123716
+Elapsed time: 10.025 seconds.
+----------------------------------------
+Mon Jul 21 13:00:00 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 16 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 0% updates
+Integer Set OK
+Committed: 1009206
+Total: 1009206
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	1009206
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Mon Jul 21 13:00:11 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 8 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 0% updates
+Integer Set OK
+Committed: 1056928
+Total: 1056928
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	1056928
+Elapsed time: 10.012 seconds.
+----------------------------------------
+Mon Jul 21 13:00:21 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 4 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 0% updates
+Integer Set OK
+Committed: 899460
+Total: 899460
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	899460
+Elapsed time: 10.004 seconds.
+----------------------------------------
+Mon Jul 21 13:00:32 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 2 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 0% updates
+Integer Set OK
+Committed: 1154542
+Total: 1154542
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	1154542
+Elapsed time: 10.003 seconds.
+----------------------------------------
+Mon Jul 21 13:00:42 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.SkipListBenchmark -t 1 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 0% updates
+Integer Set OK
+Committed: 2231126
+Total: 2231126
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	2231126
+Elapsed time: 10.004 seconds.
+----------------------------------------
+-->boosting.ListBenchmark
+Mon Jul 21 13:00:53 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 32 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 100% updates
+Integer Set OK
+Committed: 799780
+Total: 799780
+Percent committed: (100%)
+Insert/Remove calls:	799780
+Contains calls:	0
+Elapsed time: 10.083 seconds.
+----------------------------------------
+Mon Jul 21 13:01:03 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 16 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 100% updates
+Integer Set OK
+Committed: 1763258
+Total: 1763258
+Percent committed: (100%)
+Insert/Remove calls:	1763258
+Contains calls:	0
+Elapsed time: 10.221 seconds.
+----------------------------------------
+Mon Jul 21 13:01:16 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 8 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 100% updates
+Integer Set OK
+Committed: 2124254
+Total: 2124254
+Percent committed: (100%)
+Insert/Remove calls:	2124254
+Contains calls:	0
+Elapsed time: 10.013 seconds.
+----------------------------------------
+Mon Jul 21 13:01:26 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 4 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 100% updates
+Integer Set OK
+Committed: 2292988
+Total: 2292988
+Percent committed: (100%)
+Insert/Remove calls:	2292988
+Contains calls:	0
+Elapsed time: 10.009 seconds.
+----------------------------------------
+Mon Jul 21 13:01:37 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 2 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 100% updates
+Integer Set OK
+Committed: 2141862
+Total: 2141862
+Percent committed: (100%)
+Insert/Remove calls:	2141862
+Contains calls:	0
+Elapsed time: 10.007 seconds.
+----------------------------------------
+Mon Jul 21 13:01:47 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 1 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 100% updates
+Integer Set OK
+Committed: 2551840
+Total: 2551840
+Percent committed: (100%)
+Insert/Remove calls:	2551840
+Contains calls:	0
+Elapsed time: 10.006 seconds.
+----------------------------------------
+Mon Jul 21 13:01:57 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 32 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 50% updates
+Integer Set OK
+Committed: 1231933
+Total: 1231933
+Percent committed: (100%)
+Insert/Remove calls:	616753
+Contains calls:	615180
+Elapsed time: 10.169 seconds.
+----------------------------------------
+Mon Jul 21 13:02:08 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 16 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 50% updates
+Integer Set OK
+Committed: 1866036
+Total: 1866036
+Percent committed: (100%)
+Insert/Remove calls:	932053
+Contains calls:	933983
+Elapsed time: 10.026 seconds.
+----------------------------------------
+Mon Jul 21 13:02:18 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 8 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 50% updates
+Integer Set OK
+Committed: 2328392
+Total: 2328392
+Percent committed: (100%)
+Insert/Remove calls:	1164268
+Contains calls:	1164124
+Elapsed time: 10.01 seconds.
+----------------------------------------
+Mon Jul 21 13:02:28 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 4 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 50% updates
+Integer Set OK
+Committed: 2412564
+Total: 2412564
+Percent committed: (100%)
+Insert/Remove calls:	1206726
+Contains calls:	1205838
+Elapsed time: 10.007 seconds.
+----------------------------------------
+Mon Jul 21 13:02:38 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 2 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 50% updates
+Integer Set OK
+Committed: 2297479
+Total: 2297479
+Percent committed: (100%)
+Insert/Remove calls:	1149787
+Contains calls:	1147692
+Elapsed time: 10.007 seconds.
+----------------------------------------
+Mon Jul 21 13:02:49 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 1 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 50% updates
+Integer Set OK
+Committed: 2374222
+Total: 2374222
+Percent committed: (100%)
+Insert/Remove calls:	1186178
+Contains calls:	1188044
+Elapsed time: 10.004 seconds.
+----------------------------------------
+Mon Jul 21 13:02:59 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 32 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 0% updates
+Integer Set OK
+Committed: 4564830
+Total: 4564830
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	4564830
+Elapsed time: 10.032 seconds.
+----------------------------------------
+Mon Jul 21 13:03:09 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 16 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 0% updates
+Integer Set OK
+Committed: 4610189
+Total: 4610189
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	4610189
+Elapsed time: 10.021 seconds.
+----------------------------------------
+Mon Jul 21 13:03:19 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 8 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 0% updates
+Integer Set OK
+Committed: 4286296
+Total: 4286296
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	4286296
+Elapsed time: 10.006 seconds.
+----------------------------------------
+Mon Jul 21 13:03:30 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 4 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 0% updates
+Integer Set OK
+Committed: 5047368
+Total: 5047368
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	5047368
+Elapsed time: 10.012 seconds.
+----------------------------------------
+Mon Jul 21 13:03:40 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 2 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 0% updates
+Integer Set OK
+Committed: 4269814
+Total: 4269814
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	4269814
+Elapsed time: 10.009 seconds.
+----------------------------------------
+Mon Jul 21 13:03:50 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.ListBenchmark -t 1 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.ListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 0% updates
+Integer Set OK
+Committed: 4929626
+Total: 4929626
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	4929626
+Elapsed time: 10.003 seconds.
+----------------------------------------
+-->boosting.SkipListBenchmark
+Mon Jul 21 13:04:01 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 32 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 100% updates
+Integer Set OK
+Committed: 1128232
+Total: 1128232
+Percent committed: (100%)
+Insert/Remove calls:	1128232
+Contains calls:	0
+Elapsed time: 10.021 seconds.
+----------------------------------------
+Mon Jul 21 13:04:11 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 16 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 100% updates
+Integer Set OK
+Committed: 3032082
+Total: 3032082
+Percent committed: (100%)
+Insert/Remove calls:	3032082
+Contains calls:	0
+Elapsed time: 10.017 seconds.
+----------------------------------------
+Mon Jul 21 13:04:21 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 8 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 100% updates
+Integer Set OK
+Committed: 3226664
+Total: 3226664
+Percent committed: (100%)
+Insert/Remove calls:	3226664
+Contains calls:	0
+Elapsed time: 10.007 seconds.
+----------------------------------------
+Mon Jul 21 13:04:31 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 4 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 100% updates
+Integer Set OK
+Committed: 3205633
+Total: 3205633
+Percent committed: (100%)
+Insert/Remove calls:	3205633
+Contains calls:	0
+Elapsed time: 10.013 seconds.
+----------------------------------------
+Mon Jul 21 13:04:42 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 2 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 100% updates
+Integer Set OK
+Committed: 2989436
+Total: 2989436
+Percent committed: (100%)
+Insert/Remove calls:	2989436
+Contains calls:	0
+Elapsed time: 10.007 seconds.
+----------------------------------------
+Mon Jul 21 13:04:52 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 1 -n 10000 -e 100
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 100% updates
+Integer Set OK
+Committed: 3761670
+Total: 3761670
+Percent committed: (100%)
+Insert/Remove calls:	3761670
+Contains calls:	0
+Elapsed time: 10.008 seconds.
+----------------------------------------
+Mon Jul 21 13:05:02 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 32 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 50% updates
+Integer Set OK
+Committed: 3003924
+Total: 3003924
+Percent committed: (100%)
+Insert/Remove calls:	1501338
+Contains calls:	1502586
+Elapsed time: 10.023 seconds.
+----------------------------------------
+Mon Jul 21 13:05:12 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 16 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 50% updates
+Integer Set OK
+Committed: 3223519
+Total: 3223519
+Percent committed: (100%)
+Insert/Remove calls:	1611173
+Contains calls:	1612346
+Elapsed time: 10.016 seconds.
+----------------------------------------
+Mon Jul 21 13:05:23 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 8 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 50% updates
+Integer Set OK
+Committed: 3450685
+Total: 3450685
+Percent committed: (100%)
+Insert/Remove calls:	1725121
+Contains calls:	1725564
+Elapsed time: 10.009 seconds.
+----------------------------------------
+Mon Jul 21 13:05:33 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 4 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 50% updates
+Integer Set OK
+Committed: 3623544
+Total: 3623544
+Percent committed: (100%)
+Insert/Remove calls:	1811400
+Contains calls:	1812144
+Elapsed time: 10.006 seconds.
+----------------------------------------
+Mon Jul 21 13:05:43 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 2 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 50% updates
+Integer Set OK
+Committed: 3488091
+Total: 3488091
+Percent committed: (100%)
+Insert/Remove calls:	1743867
+Contains calls:	1744224
+Elapsed time: 10.005 seconds.
+----------------------------------------
+Mon Jul 21 13:05:54 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 1 -n 10000 -e 50
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 50% updates
+Integer Set OK
+Committed: 3647841
+Total: 3647841
+Percent committed: (100%)
+Insert/Remove calls:	1824377
+Contains calls:	1823464
+Elapsed time: 10.008 seconds.
+----------------------------------------
+Mon Jul 21 13:06:04 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 32 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 32
+Mix: 0% updates
+Integer Set OK
+Committed: 4452474
+Total: 4452474
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	4452474
+Elapsed time: 10.041 seconds.
+----------------------------------------
+Mon Jul 21 13:06:15 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 16 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 16
+Mix: 0% updates
+Integer Set OK
+Committed: 4577377
+Total: 4577377
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	4577377
+Elapsed time: 10.015 seconds.
+----------------------------------------
+Mon Jul 21 13:06:25 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 8 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 8
+Mix: 0% updates
+Integer Set OK
+Committed: 4540394
+Total: 4540394
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	4540394
+Elapsed time: 10.012 seconds.
+----------------------------------------
+Mon Jul 21 13:06:36 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 4 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 4
+Mix: 0% updates
+Integer Set OK
+Committed: 4367905
+Total: 4367905
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	4367905
+Elapsed time: 10.005 seconds.
+----------------------------------------
+Mon Jul 21 13:06:46 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 2 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 2
+Mix: 0% updates
+Integer Set OK
+Committed: 4917966
+Total: 4917966
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	4917966
+Elapsed time: 10.006 seconds.
+----------------------------------------
+Mon Jul 21 13:06:56 2008
+/pro/java/linux/jdk1.6/jre/bin/java -classpath "dstm2.1.jar:/u/mph/My Documents/dstm2.1-beta/bcel/bcel-5.2.jar" dstm2.Main -m dstm2.manager.AggressiveManager -a dstm2.factory.ofree.Adapter -b dstm2.benchmark.boosting.SkipListBenchmark -t 1 -n 10000 -e 0
+Duration: 10000
+Benchmark: class dstm2.benchmark.boosting.SkipListBenchmark
+Adapter: dstm2.factory.ofree.Adapter
+Contention manager: dstm2.manager.AggressiveManager
+Threads: 1
+Mix: 0% updates
+Integer Set OK
+Committed: 5122094
+Total: 5122094
+Percent committed: (100%)
+Insert/Remove calls:	0
+Contains calls:	5122094
+Elapsed time: 10.006 seconds.
+----------------------------------------

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/config.pl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/config.pl	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/config.pl	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,56 @@
+#############################################################################
+# License and other legal information
+#
+# Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle, Santa
+# Clara, California 95054, U.S.A.  All rights reserved
+#
+# Sun Microsystems, Inc. has intellectual property rights relating to
+# technology embodied in the product that is described in this
+# document.  In particular, and without limitation, these
+# intellectual property rights may include one or more of the
+# U.S. patents listed at http://www.sun.com/patents and one or more
+# additional patents or pending patent applications in the U.S. and
+# in other countries.
+#
+# U.S. Government Rights - Commercial software.
+# Government users are subject to the Sun Microsystems, Inc. standard
+# license agreement and applicable provisions of the FAR and its
+# supplements.  Use is subject to license terms.  Sun, Sun
+# Microsystems, the Sun logo and Java are trademarks or registered
+# trademarks of Sun Microsystems, Inc. in the U.S. and other
+# countries.
+#
+# This product is covered and controlled by U.S. Export Control laws
+# and may be subject to the export or import laws in other countries.
+# Nuclear, missile, chemical biological weapons or nuclear maritime
+# end uses or end users, whether direct or indirect, are strictly
+# prohibited.  Export or reexport to countries subject to
+# U.S. embargo or to entities identified on U.S. export exclusion
+# lists, including, but not limited to, the denied persons and
+# specially designated nationals lists is strictly prohibited.
+
+#############################################################################
+# Configuration options
+#
+
+use Env;
+
+# Location of benchmark code (class files)
+$codedir = "../dist";
+
+# JVM
+if ($ENV{HOSTNAME} eq "towhee") {
+  $jvm = "\"c:\\WINDOWS\\system32\\java\"";
+  $classpath = "dstm2.1.jar;c:\\Documents and Settings\\mph\\My Documents\\dstm2.1-beta\\bcel\\bcel-5.2.jar"
+} elsif ($ENV{HOSTNAME} eq "oriole") {
+  $jvm = "/pro/java/linux/jdk1.6/jre/bin/java";
+  $classpath = "dstm2.1.jar:/u/mph/My\ Documents/dstm2.1-beta/bcel/bcel-5.2.jar"
+} else {
+  $jvm	 = "/lab/tools/src/jdk/1.6.0/bin/java";
+  $classpath = "/home/mh109922/dstm2.1-beta/dist/dstm2.1.jar:/home/mh109922/dstm2.1-beta/bcel/bcel-5.2.jar"
+}
+
+# Execution string for the benchmark
+$prog = "$jvm -classpath \"$classpath\" dstm2.Main";
+
+1;     # return true

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/foo
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/foo	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/foo	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,277 @@
+Analysing results...
+
+Duration: 10000
+
+Adapter: ofree	Manager: Aggressive
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	454787	
+
+Adapter: ofree	Manager: Kindergarten
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	2208196	
+
+Adapter: ofree	Manager: Eruption
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	690375	
+
+Adapter: ofree	Manager: Karma
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	3221094	
+
+Adapter: ofree	Manager: Null
+Mix	1	2	4	8	16	32	
+0	71332540	67465976	66858193	65031338	64652202	53991950	
+50	54704678	47192736	49513193	49494648	47913630	38351479	
+100	53568662	41938599	42173867	41544326	39114278	15240446	
+
+Adapter: ofree	Manager: Polka
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1445295	
+
+Adapter: ofree	Manager: Backoff
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	988220	
+
+Adapter: ofree	Manager: Priority
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1916065	
+
+Adapter: ofree	Manager: Greedy
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	2255109	
+
+Adapter: recycle	Manager: Aggressive
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	459299	
+
+Adapter: recycle	Manager: Kindergarten
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1907508	
+
+Adapter: recycle	Manager: Eruption
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	751479	
+
+Adapter: recycle	Manager: Karma
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	2318039	
+
+Adapter: recycle	Manager: Null
+Mix	1	2	4	8	16	32	
+0	36309856	33114850	34218128	32546749	32586564	31161538	
+50	26850234	22762082	24522373	24373768	23994272	17462211	
+100	25324098	20229021	22071491	21084304	18992089	0	
+
+Adapter: recycle	Manager: Polka
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1818509	
+
+Adapter: recycle	Manager: Backoff
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1992657	
+
+Adapter: recycle	Manager: Priority
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	2322311	
+
+Adapter: recycle	Manager: Greedy
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	906983	
+
+Adapter: shadow	Manager: Aggressive
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	484019	
+
+Adapter: shadow	Manager: Kindergarten
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	2765115	
+
+Adapter: shadow	Manager: Eruption
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	711420	
+
+Adapter: shadow	Manager: Karma
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1486543	
+
+Adapter: shadow	Manager: Null
+Mix	1	2	4	8	16	32	
+0	35717198	33151260	32936457	32347950	32258639	27832681	
+50	28092303	22847118	24882605	24629249	24173189	19479545	
+100	27204825	20822219	21597742	20895531	19752619	0	
+
+Adapter: shadow	Manager: Polka
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1583022	
+
+Adapter: shadow	Manager: Backoff
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	2094812	
+
+Adapter: shadow	Manager: Priority
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	873638	
+
+Adapter: shadow	Manager: Greedy
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	2390924	
+
+Adapter: shadow.invisible	Manager: Aggressive
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	480073	
+
+Adapter: shadow.invisible	Manager: Kindergarten
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	2856037	
+
+Adapter: shadow.invisible	Manager: Eruption
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	2776525	
+
+Adapter: shadow.invisible	Manager: Karma
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1346260	
+
+Adapter: shadow.invisible	Manager: Null
+Mix	1	2	4	8	16	32	
+0	36076121	31978839	34814691	32249596	32583606	30225543	
+50	28012044	24072974	24120595	24365215	24041507	18438347	
+100	25978272	20646532	21293957	20749787	19483986	0	
+
+Adapter: shadow.invisible	Manager: Polka
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1226080	
+
+Adapter: shadow.invisible	Manager: Backoff
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1114605	
+
+Adapter: shadow.invisible	Manager: Priority
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	962693	
+
+Adapter: shadow.invisible	Manager: Greedy
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	698915	
+
+Adapter: twophase	Manager: Aggressive
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	460985	
+
+Adapter: twophase	Manager: Kindergarten
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1222025	
+
+Adapter: twophase	Manager: Eruption
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1067613	
+
+Adapter: twophase	Manager: Karma
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	2596256	
+
+Adapter: twophase	Manager: Null
+Mix	1	2	4	8	16	32	
+0	35900540	33806826	33523104	32721915	32428360	31253832	
+50	26980439	23676705	24672899	24302576	24063012	18019308	
+100	25608448	20741100	21081113	20636743	19675844	0	
+
+Adapter: twophase	Manager: Polka
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1496018	
+
+Adapter: twophase	Manager: Backoff
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	1712361	
+
+Adapter: twophase	Manager: Priority
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	774082	
+
+Adapter: twophase	Manager: Greedy
+Mix	1	2	4	8	16	32	
+0	0	0	0	0	0	0	
+50	0	0	0	0	0	0	
+100	0	0	0	0	0	2075325	
+
+
+Done.
+

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/recycle.xls
===================================================================
(Binary files differ)


Property changes on: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/recycle.xls
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/report.pl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/report.pl	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/report.pl	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,88 @@
+#! /pkg/gnu/bin/perl
+
+($destdir) = (`pwd`);
+chomp $destdir;
+
+
+print "Analysing results...\n\n";
+
+# each hash maps adapter -> nthreads -> value
+# sum event values
+%elapsedTotal = ();
+%commitTrans = ();
+%allTrans = ();
+
+# index sets
+%adapterSet = ();
+%mixSet = ();
+%threadSet  = ();
+%managerSet  = ();
+
+$rawoutfile = $ARGV[0];
+$titlestring = $ARGV[1];
+# Read data in from the file
+open(RAW, "<", $rawoutfile) || die("Can't reopen raw output file $rawoutfile");
+
+while (<RAW>) {
+  # Benchmark name
+  if (/Threads: (\d+)/) {
+    $nthreads = $1;
+    $threadSet{$1} = 1;
+  } elsif (/Duration: (\d+)/) {
+    $duration = $1;
+  } elsif (/Adapter: dstm2\.factory\.(\w+)\.Adapter/) {
+    $adapter = $1;
+    $adapterSet{$1} = 1;
+  } elsif (/Adapter: dstm2\.factory\.(\w+)\.(\w+)\.Adapter/) {
+    $adapter = "$1\.$2";
+    $adapterSet{$adapter} = 1;
+  } elsif (/Adapter: dstm2\.factory\.(\w+)\.(\w+)\.(\w+)\.Adapter/) {
+    $adapter = "$1\.$2\.$3";
+    $adapterSet{$adapter} = 1;
+  } elsif (/Contention manager: dstm2\.manager\.(\w+)Manager/) {
+    $manager = $1;
+    $managerSet{$1} = 1;
+  } elsif (/Mix: (\d+)/) {
+    $mix = $1;
+    $mixSet{$1} = 1;
+  } elsif (/Committed: (\d+)/) {
+    $commitTrans{$adapter}{$manager}{$mix}{$nthreads} += $1;
+  } elsif (/Total: (\d+)/) {
+    $allTrans{$adapter}{$manager}{$mix}{$nthreads} += $1;
+  } elsif (/Elapsed time: (\d+\.\d+) seconds./) {
+    $elapsedTotal{$adapter}{$manager}{$mix}{$nthreads} += $1;
+  }
+}
+
+###
+### Print report
+###
+print "Duration: $duration\n";
+$normalize = ($duration / 100);
+foreach my $adapter (sort{ $a cmp $b }(keys %adapterSet)) {
+  foreach my $manager (sort{ $a <=> $b }(keys %managerSet)) {
+    print "\nAdapter: $adapter\tManager: $manager\n";
+    print("Mix\t");
+    foreach my $thread (sort{ $a <=> $b }(keys %threadSet)) {
+      print "$thread\t";
+    }
+    print("\n");
+    foreach my $mix (sort{ $a <=> $b }(keys %mixSet)) {
+      print "$mix\t";
+      foreach my $thread (sort{ $a <=> $b }(keys %threadSet)) {
+	my $tps = $commitTrans{$adapter}{$manager}{$mix}{$thread} / $normalize;
+#	my $tps = $commitTrans{$adapter}{$manager}{$mix}{$thread};
+	my $tt = sprintf("%d", $tps);
+	print "$tt\t";
+      }
+      print "\n";
+    }
+  }
+}
+print "\n\n";
+
+###
+### Done.
+###
+
+print "Done.\n\n";

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/report.txt
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/report.txt	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/report.txt	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,207 @@
+Analysing results...
+
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+->recycle
+
+
+Mix: 0
+dstm2.manager.BackoffManager
+		1	2	4	8	16	32
+recycle	70552.7	91665.15	65856.2	96470.9	73618.9	61781.75dstm2.manager.EruptionManager
+		1	2	4	8	16	32
+recycle	64600.35	474.2	17.95	18.65	703.9	1316.35dstm2.manager.KindergartenManager
+		1	2	4	8	16	32
+recycle	70449.6	736.3	64.15	3613.85	7884.5	5935.55dstm2.manager.AggressiveManager
+		1	2	4	8	16	32
+recycle	122273.9	482.4	8.4	168.1	534.45	507.1dstm2.manager.PolkaManager
+		1	2	4	8	16	32
+recycle	143894.7	1067.3	13.6	121.9	4992.8	49.4dstm2.manager.GreedyManager
+		1	2	4	8	16	32
+recycle	69711.6	27618	24201.15	19780.05	23157.1	15889.4dstm2.manager.KarmaManager
+		1	2	4	8	16	32
+recycle	65531.45	1157.65	28.7	11.25	596.8	874.75dstm2.manager.PriorityManager
+		1	2	4	8	16	32
+recycle	123710.3	28444.85	16848.4	15190.45	4115.8	14237.05
+
+Mix: 50
+dstm2.manager.BackoffManager
+		1	2	4	8	16	32
+recycle	12342.25	6840	4034.15	2200.55	1249.2	875.3dstm2.manager.EruptionManager
+		1	2	4	8	16	32
+recycle	12110.2	4486.15	8.45	4.15	11.15	14.65dstm2.manager.KindergartenManager
+		1	2	4	8	16	32
+recycle	12967.3	19.35	30.05	4.9	177.1	53.85dstm2.manager.AggressiveManager
+		1	2	4	8	16	32
+recycle	13289.55	27	3.05	7.7	15.85	16.45dstm2.manager.PolkaManager
+		1	2	4	8	16	32
+recycle	13516.4	12425.85	13417.95	8488.3	11398.2	10267.75dstm2.manager.GreedyManager
+		1	2	4	8	16	32
+recycle	12336	5517.55	2590.65	1324.45	775.5	573.5dstm2.manager.KarmaManager
+		1	2	4	8	16	32
+recycle	10710.7	9.35	4.85	15.2	8.2	41.5dstm2.manager.PriorityManager
+		1	2	4	8	16	32
+recycle	14326.9	4643.6	2325.15	934.7	713.4	89.35
+
+Mix: 100
+dstm2.manager.BackoffManager
+		1	2	4	8	16	32
+recycle	10875.8	6530.65	3577.4	2082.25	1073.2	623.5dstm2.manager.EruptionManager
+		1	2	4	8	16	32
+recycle	10494.9	9.05	2.05	826.6	534.55	82.1dstm2.manager.KindergartenManager
+		1	2	4	8	16	32
+recycle	11187.9	51	5.6	233.15	118.6	147.05dstm2.manager.AggressiveManager
+		1	2	4	8	16	32
+recycle	12775.3	12.15	4.4	1.95	21.15	13.4dstm2.manager.PolkaManager
+		1	2	4	8	16	32
+recycle	11921.45	11298.5	10508.05	8148.6	9259.35	6671.6dstm2.manager.GreedyManager
+		1	2	4	8	16	32
+recycle	10887.45	4861.6	2013.2	1047.75	448.7	480.05dstm2.manager.KarmaManager
+		1	2	4	8	16	32
+recycle	11537.15	7.25	2.9	2	38.95	9.05dstm2.manager.PriorityManager
+		1	2	4	8	16	32
+recycle	11702.5	4019.4	2041.2	917.55	664.95	420.05
+
+Done.
+

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/report2.pl
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/report2.pl	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/report2.pl	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,98 @@
+#! /pkg/gnu/bin/perl
+
+($destdir) = (`pwd`);
+chomp $destdir;
+
+
+print "Analysing results...\n\n";
+
+# each hash maps adapter -> nthreads -> value
+# sum event values
+%elapsedTotal = ();
+%commitTrans = ();
+%allTrans = ();
+
+# index sets
+%benchmarkSet = ();
+%adapterSet = ();
+%mixSet = ();
+%threadSet  = ();
+%managerSet  = ();
+
+$rawoutfile = $ARGV[0];
+$titlestring = $ARGV[1];
+# Read data in from the file
+open(RAW, "<", $rawoutfile) || die("Can't reopen raw output file $rawoutfile");
+
+while (<RAW>) {
+  # Benchmark name
+  if (/Benchmark: class dstm2.benchmark.(\S+)/) {
+    $benchmark = $1;
+    if (!$benchmarkSet{$benchmark}) {
+      printf "==>benchmark is $benchmark \n";
+    }
+    $benchmarkSet{$benchmark} = 1;
+  } elsif (/Threads: (\d+)/) {
+    $nthreads = $1;
+    $threadSet{$1} = 1;
+  } elsif (/Duration: (\d+)/) {
+    $duration = $1;
+  } elsif (/Adapter: dstm2\.factory\.(\w+)\.Adapter/) {
+    $adapter = $1;
+    $adapterSet{$1} = 1;
+  } elsif (/Adapter: dstm2\.factory\.(\w+)\.(\w+)\.Adapter/) {
+    $adapter = "$1\.$2";
+    $adapterSet{$adapter} = 1;
+  } elsif (/Adapter: dstm2\.factory\.(\w+)\.(\w+)\.(\w+)\.Adapter/) {
+    $adapter = "$1\.$2\.$3";
+    $adapterSet{$adapter} = 1;
+  } elsif (/Contention manager: dstm2\.manager\.(\w+)Manager/) {
+    $manager = $1;
+    $managerSet{$1} = 1;
+  } elsif (/Mix: (\d+)/) {
+    $mix = $1;
+    $mixSet{$1} = 1;
+  } elsif (/Committed: (\d+)/) {
+    $commitTrans{$benchmark}{$adapter}{$manager}{$mix}{$nthreads} += $1;
+  } elsif (/Total: (\d+)/) {
+    $allTrans{$benchmark}{$adapter}{$manager}{$mix}{$nthreads} += $1;
+  } elsif (/Elapsed time: (\d+\.\d+) seconds./) {
+    $elapsedTotal{$benchmark}{$adapter}{$manager}{$mix}{$nthreads} += $1;
+  }
+}
+
+###
+### Print report
+###
+print "Duration: $duration\n";
+$normalize = ($duration / 100);
+foreach my $benchmark (sort{ $a cmp $b }(keys benchmarkSet)) {
+  print "\nBenchmark: $benchmark\n";
+  foreach my $adapter (sort{ $a cmp $b }(keys %adapterSet)) {
+    foreach my $manager (sort{ $a <=> $b }(keys %managerSet)) {
+      print "\nAdapter: $adapter\tManager: $manager\n";
+      print("Mix/Thds\t");
+      foreach my $thread (sort{ $a <=> $b }(keys %threadSet)) {
+	print "$thread\t";
+      }
+      print("\n");
+      foreach my $mix (sort{ $a <=> $b }(keys %mixSet)) {
+	print "$mix\t";
+	foreach my $thread (sort{ $a <=> $b }(keys %threadSet)) {
+	  my $tps = $commitTrans{$benchmark}{$adapter}{$manager}{$mix}{$thread} / $normalize;
+	  #	my $tps = $commitTrans{$adapter}{$manager}{$mix}{$thread};
+	  my $tt = sprintf("%d", $tps);
+	  print "$tt\t";
+	}
+	print "\n";
+      }
+    }
+  }
+}
+print "\n\n";
+
+###
+### Done.
+###
+
+print "Done.\n\n";

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/towhee.xls
===================================================================
(Binary files differ)


Property changes on: labs/jbosstm/workspace/whitingjr/trunk/dstm2/test/towhee.xls
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: labs/jbosstm/workspace/whitingjr/trunk/dstm2/todo
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/dstm2/todo	                        (rev 0)
+++ labs/jbosstm/workspace/whitingjr/trunk/dstm2/todo	2009-05-15 16:18:16 UTC (rev 26568)
@@ -0,0 +1,148 @@
+Done:
+
+changed ofree and shadow factories to be static.
+
+Added abort() call in response to abortexception.
+
+
+-=-=-=-=
+
+
+Use interrupts instead of gracefulexception
+
+rochester wish-list
+
+bugs
+
+thread-local initialization
+
+early release
+
+ - We seem to have hooks for on{Abort,Commit,Validate}[Once].  It would
+   be helpful to us to have an onBeginTxn as well.
+
+ - For lazy acquire we think we need a beforeCommitOnce hook that we
+   can use to acquire written objects.  We don't think we can roll this
+   into onValidateOnce, because that may be called at other times as
+   well, and we don't think we can roll it into onCommitOnce, because
+   that happens _after_ commit, and we need to be able to abort if
+   we're unable to acquire something.
+
+ - In RSTM we maintain several lists of objects in the transaction
+   descriptor: a read list, a write list, and a lazy write list (not
+   all lists are used in all protocol variants).  If I understand
+   correctly, the natural way to use DSTM2 is not to maintain these
+   explicitly, but rather to register per-object callables that will be
+   invoked at Validate time, Commit time, or Abort time.  This concerns
+   us for several reasons:
+
+     - Iterating over our own lists of objects is already a significant
+       overhead component in RSTM.  We worry that adding an extra
+       method invocation for every object (not to mention the memory
+       churn of creating and destroying the callables themselves [our
+       metadata lists are self-resizing Vectors, so they rarely perform
+       memory management]) may be really slow.
+
+     - We don't see a way to amortize validation over multiple getters.
+       In RSTM we use smart pointer initialization as the moral equivalent
+       of explicit openRO and openRW calls, with the result that in
+       most cases we open a given object for reading only once per
+       transaction.  With DSTM2 it looks like we'll be opening each
+       object every time we call a getter.  We fear this will make the
+       aggregate overhead of validation completely insufferable.
+       Absent compiler support for elision of redundant validate calls,
+       the natural approach would seem to be to maintain a hashMap that
+       lists previously read objects (and their versions), and returns
+       the previously read version without validating whenever we open
+       the same object a second time.  We don't see how to implement
+       this option with the register-callables mechanism.
+
+     - We had originally hoped to create a library that could be used
+       conveniently with DSTM2 or, less conveniently, stand-alone.  If
+       the front end keeps the metadata, stand-alone doesn't work.
+
+ - If we try instead to maintain our own per-transaction metadata, we
+   can of course keep it in a table indexed by thread id.  It seems
+   like it would be nicer, though, to be able to extend the DSTM2
+   thread class, or to extend the transaction descriptor within the
+   thread class.
+
+ - On the other hand, if we're keeping our own per-transaction
+   metadata, and we have to do our own byte code engineering to create
+   clones (as I gather the DSTM back end does), it isn't clear that
+   there's a lot of value added to using the front-end factory.  Being
+   application source-code compatible is certainly nice, but we had
+   originally hoped to leverage a lot more of the DSTM2 infrastructure,
+   and Aaron is struggling with whether there's really much opportunity
+   there.
+
+We'd be grateful for clarifications of anything above that we don't seem
+to understand.  If we are right about the extra hooks (onBeginTransaction,
+beforeCommitOnce, ability to extend thread/descriptor), it would be
+great if those could be added to the code base.  And in general we'd
+welcome any other thoughts.
+-=-=-=
+Hi Maurice,
+  I was implementing the RSTM HashTable benchmark using the DSTM2
+benchmark framework (List) and I think I might have found an
+off-by-one bug in the iterator() function. I know that a lot has
+changed since the version I'm using ... but I thought I would pass it
+along just in case.
+
+The problem is that the next() function stores the old value of cursor
+... updates it ... and then moves the cursor forward one step. The old
+value is then returned to the user. In hasNext(), the function doesn't
+just look at the cursor, but instead looks at the value after the
+cursor. However, cursor was never returned to the user.
+
+I modified the List(Release)::hasNext function to look like:
+public boolean hasNext() {
+     return cursor.getValue() != Integer.MAX_VALUE;
+}
+
+Thanks again for talking with me earlier today. It was quite helpful.
+Aaron
+
+-=-=-=-=
+
+I'm a PhD student in the UK. I downloaded the DSTM2 sources today, built
+it, and tried running List.pl in test/ and it failed it's second run
+because the ofree.invisible package doesn't exist. Perhaps the factory is
+missing or the perl script is out of date? Great work, by the way, and
+apologies if I've overlooked something.
+-=0-=-=-=
+
+
+Thanks for your reply. I've been playing around with DSTM2 today, and
+apart from the factory there was only a minor bug in the Main class. If
+you run the program with no arguments it crashes rather than gracefully
+exiting with the usage message. This is easily fixed with either an
+if(args.length==0) check, or you can change the while loop at line 61 (in
+Main) to be a do{}while() loop.
+
+
+
+I've been using DSTM2 for a short while now, primarily toying with a new
+non-trivial benchmark we've written to get it's performance acceptable.
+Unfortunately, so far the more threads I add the worse the performance
+gets (4-way dual-core Opteron machine).
+
+The first issue I had was that I needed to create over a million objects,
+each with a single int value, but ran completely out of physical memory
+(16GB) after about 200k objects, or 33k objects on my 2GB desktop. I
+played around and eventually found that it was because each factory was
+keeping it's own copy of the BCEL runtime generated class, despite not
+needing to (in theory you only need one for the AtomicFactory, and one for
+the factory associated with the adapter), so I put them in public static
+HashMaps. This, and a few other HashMapped-objects, brought down the
+memory requirement for 1.4 million objects from 90GB to ~3GB. Although
+this is still quite large, at least I can run it, and I ran my benchmark
+with debug on, and the multithreaded outcome was fine. Although I've
+described it briefly, do you see any real problems with what I've said,
+and would you like a patch (against the released version) for this space
+efficiency?
+
+Secondly, I'd like to run my app through early release and snapshot, but
+since (as you've mentioned earlier) they aren't functional, I was
+wondering if you'd be willing to give me a tarball/zip of DSTM2 that does
+have working early release and snapshot.




More information about the jboss-svn-commits mailing list