Mail Archive Home | gotm-commits List | May 2005 Index
| <-- Date Index | <-- Thread Index |
Date: Monday, May 23, 2005 @ 13:21:01
Author: rouvoy
Path: /cvsroot/gotm/gotm-jts
Modified: .settings/org.eclipse.core.resources.prefs
example/benchmark/build.xml
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/CounterImpl.java
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/JtaClient.java
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/TransactionScenarioImpl.java
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Collector.java
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Serie.java
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/SerieMin.java
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Timer.java
example/local/src/java/org/objectweb/gotm/jts/local/CounterImpl.java
example/local/src/java/org/objectweb/gotm/jts/local/JtaClient.java
src/fractal/org/objectweb/gotm/lib/TpJTSImpl.fractal
src/fractal/org/objectweb/gotm/lib/TpManagerImpl.fractal
src/fractal/org/objectweb/gotm/lib/TpTransactionImpl.fractal
src/java/org/objectweb/gotm/lib/jta/SynchronizationImpl.java
src/java/org/objectweb/gotm/lib/jta/TransactionImpl.java
src/java/org/objectweb/gotm/lib/jta/XAResourceImpl.java
Removed: src/fractal/org/objectweb/gotm/lib/TpActivationImpl.fractal
src/fractal/org/objectweb/gotm/lib/TpCoordinatorImpl.fractal
src/fractal/org/objectweb/gotm/lib/TpInterruptionImpl.fractal
* Logging improved,
* Performance improved,
* Cosmetic Updates.
------------------------------------------------------------------------------------------+
.settings/org.eclipse.core.resources.prefs
| 21 -
example/benchmark/build.xml
| 5
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/CounterImpl.java
| 40 +-
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/JtaClient.java
| 56 +-
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/TransactionScenarioImpl.java
| 72 +--
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Collector.java
| 8
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Serie.java
| 36 +
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/SerieMin.java
| 8
example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Timer.java
| 8
example/local/src/java/org/objectweb/gotm/jts/local/CounterImpl.java
| 30 -
example/local/src/java/org/objectweb/gotm/jts/local/JtaClient.java
| 58 +-
src/fractal/org/objectweb/gotm/lib/TpActivationImpl.fractal
| 21 -
src/fractal/org/objectweb/gotm/lib/TpCoordinatorImpl.fractal
| 29 -
src/fractal/org/objectweb/gotm/lib/TpInterruptionImpl.fractal
| 21 -
src/fractal/org/objectweb/gotm/lib/TpJTSImpl.fractal
| 8
src/fractal/org/objectweb/gotm/lib/TpManagerImpl.fractal
| 14
src/fractal/org/objectweb/gotm/lib/TpTransactionImpl.fractal
| 48 +-
src/java/org/objectweb/gotm/lib/jta/SynchronizationImpl.java
| 87 ++--
src/java/org/objectweb/gotm/lib/jta/TransactionImpl.java
| 96 ----
src/java/org/objectweb/gotm/lib/jta/XAResourceImpl.java
| 194 ++++------
20 files changed, 330 insertions(+), 530 deletions(-)
Index: gotm-jts/.settings/org.eclipse.core.resources.prefs
diff -u gotm-jts/.settings/org.eclipse.core.resources.prefs:1.4
gotm-jts/.settings/org.eclipse.core.resources.prefs:1.5
--- gotm-jts/.settings/org.eclipse.core.resources.prefs:1.4 Wed Mar 2
16:27:51 2005
+++ gotm-jts/.settings/org.eclipse.core.resources.prefs Mon May 23 13:21:01
2005
@@ -1,14 +1,13 @@
-#Wed Mar 02 15:24:58 CET 2005
-encoding//src/fractal/org/objectweb/gotm/lib/TpTransactionImpl.fractal=ISO-8859-1
-encoding//src/fractal/org/objectweb/gotm/lib/TpJTSImpl.fractal=ISO-8859-1
-encoding//src/fractal/org/objectweb/gotm/lib/TpManagerImpl.fractal=ISO-8859-1
-encoding//example/local/src/fractal/org/objectweb/gotm/jts/local/FcApplication.fractal=ISO-8859-1
+#Wed Apr 20 19:34:45 CEST 2005
+eclipse.preferences.version=1
+encoding//example/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcApplication.fractal=ISO-8859-1
encoding//example/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcExplorer.fractal=ISO-8859-1
-encoding//src/fractal/org/objectweb/gotm/lib/TpCoordinatorImpl.fractal=ISO-8859-1
-encoding//src/fractal/org/objectweb/gotm/lib/TpTerminatorImpl.fractal=ISO-8859-1
-encoding//src/fractal/org/objectweb/gotm/lib/TpResourceImpl.fractal=ISO-8859-1
+encoding//example/benchmark/src/fractal/org/objectweb/gotm/lib/FcExplorerImpl.fractal=ISO-8859-1
+encoding//example/local/src/fractal/org/objectweb/gotm/jts/local/FcApplication.fractal=ISO-8859-1
+encoding//example/local/src/fractal/org/objectweb/gotm/jts/local/FcExplorer.fractal=ISO-8859-1
encoding//example/local/src/fractal/org/objectweb/gotm/lib/FcExplorerImpl.fractal=ISO-8859-1
-encoding//example/benchmark/src/fractal/org/objectweb/gotm/jts/benchmark/FcApplication.fractal=ISO-8859-1
-eclipse.preferences.version=1
encoding//src/fractal/org/objectweb/gotm/lib/FcTransactionManagerImpl.fractal=ISO-8859-1
-encoding//example/local/src/fractal/org/objectweb/gotm/jts/local/FcExplorer.fractal=ISO-8859-1
+encoding//src/fractal/org/objectweb/gotm/lib/TpJTSImpl.fractal=ISO-8859-1
+encoding//src/fractal/org/objectweb/gotm/lib/TpManagerImpl.fractal=ISO-8859-1
+encoding//src/fractal/org/objectweb/gotm/lib/TpResourceImpl.fractal=ISO-8859-1
+encoding//src/fractal/org/objectweb/gotm/lib/TpTransactionImpl.fractal=ISO-8859-1
Index: gotm-jts/example/benchmark/build.xml
diff -u gotm-jts/example/benchmark/build.xml:1.4
gotm-jts/example/benchmark/build.xml:1.5
--- gotm-jts/example/benchmark/build.xml:1.4 Tue Apr 19 11:38:09 2005
+++ gotm-jts/example/benchmark/build.xml Mon May 23 13:21:01 2005
@@ -21,7 +21,7 @@
<!-- Initial developer(s): Romain Rouvoy. -->
<!-- Contributor(s): ______________________________________. -->
-<!-- $Id: build.xml,v 1.4 2005/04/19 09:38:09 rouvoy Exp $ -->
+<!-- $Id: build.xml,v 1.5 2005/05/23 11:21:01 rouvoy Exp $ -->
<!-- ==================================================================== -->
<project name="JTS Benchmark" default="all">
@@ -90,8 +90,9 @@
value="org.objectweb.fractal.julia.loader.DynamicLoader" />
<sysproperty key="julia.config"
value="${julia.cfg},${cache.cfg}" />
+<!-- <jvmarg line="-XX:NewSize=128m -XX:MaxNewSize=128m
-XX:SurvivorRatio=8 -Xms512m -Xmx512m"/>-->
<!-- <jvmarg
line="-Xbootclasspath/p:${build.dir}/${lib.dir}/thread.jar"/>-->
- <arg line="-fractal org.objectweb.gotm.jts.benchmark.FcApplication
r"/>
+ <arg line=" -fractal org.objectweb.gotm.jts.benchmark.FcApplication
r"/>
<!-- <arg line="-fractal org.objectweb.gotm.lib.xid.FcXidStateFctr
r"/> -->
</java>
</target>
Index:
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/CounterImpl.java
diff -u
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/CounterImpl.java:1.3
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/CounterImpl.java:1.4
---
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/CounterImpl.java:1.3
Tue Apr 19 11:38:09 2005
+++
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/CounterImpl.java
Mon May 23 13:21:00 2005
@@ -22,7 +22,7 @@
Contributor(s): ______________________________________.
---------------------------------------------------------------------
- $Id: CounterImpl.java,v 1.3 2005/04/19 09:38:09 rouvoy Exp $
+ $Id: CounterImpl.java,v 1.4 2005/05/23 11:21:00 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.jts.benchmark;
@@ -39,8 +39,8 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 3 janv. 2005
- * @modified $Date: 2005/04/19 09:38:09 $
- * @version $Revision: 1.3 $
+ * @modified $Date: 2005/05/23 11:21:00 $
+ * @version $Revision: 1.4 $
* @fractal.itf name="synchronization" role="server"
signature="javax.transaction.Synchronization"
* @fractal.itf name="xa-resource" role="server"
signature="javax.transaction.xa.XAResource"
*/
@@ -70,19 +70,19 @@
* @see javax.transaction.Synchronization#beforeCompletion()
*/
public void beforeCompletion() {
- getTrace().debug("Receiving beforeCompletion()...");
+// getLogger().log(DEBUG,"Receiving beforeCompletion()...");
}
/* (non-Javadoc)
* @see javax.transaction.Synchronization#afterCompletion(int)
*/
public void afterCompletion(int arg0) {
- getTrace().debug("Receiving afterCompletion("+arg0+")...");
- try {
- Thread.sleep(1);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
+// getLogger().log(DEBUG,"Receiving afterCompletion("+arg0+")...");
+// try {
+// Thread.sleep(1);
+// } catch (InterruptedException e) {
+// e.printStackTrace();
+// }
if (arg0 == Status.STATUS_COMMITTED) {
this.counter += this.clone ;
}
@@ -137,28 +137,28 @@
* @see javax.transaction.xa.XAResource#commit(javax.transaction.xa.Xid,
boolean)
*/
public void commit(Xid arg0, boolean arg1) {
- getTrace().debug("Receiving setTransactionTimeout("+arg0+")");
+// getLogger().log(DEBUG,"Receiving setTransactionTimeout("+arg0+")");
}
/* (non-Javadoc)
* @see javax.transaction.xa.XAResource#end(javax.transaction.xa.Xid,
int)
*/
public void end(Xid arg0, int arg1) {
- getTrace().debug("Receiving end("+arg0+", "+arg1+")");
+// getLogger().log(DEBUG,"Receiving end("+arg0+", "+arg1+")");
}
/* (non-Javadoc)
* @see javax.transaction.xa.XAResource#forget(javax.transaction.xa.Xid)
*/
public void forget(Xid arg0) {
- getTrace().debug("Receiving forget("+arg0+")");
+// getLogger().log(DEBUG,"Receiving forget("+arg0+")");
}
/* (non-Javadoc)
* @see javax.transaction.xa.XAResource#getTransactionTimeout()
*/
public int getTransactionTimeout() {
- getTrace().debug("Receiving getTransactionTimeout()");
+// getLogger().log(DEBUG,"Receiving getTransactionTimeout()");
return 0;
}
@@ -166,7 +166,7 @@
* @see
javax.transaction.xa.XAResource#isSameRM(javax.transaction.xa.XAResource)
*/
public boolean isSameRM(XAResource arg0) {
- getTrace().debug("Receiving setTransactionTimeout("+arg0+")");
+// getLogger().log(DEBUG,"Receiving setTransactionTimeout("+arg0+")");
return false;
}
@@ -174,7 +174,7 @@
* @see javax.transaction.xa.XAResource#prepare(javax.transaction.xa.Xid)
*/
public int prepare(Xid arg0) {
- getTrace().debug("Receiving prepare("+arg0+")");
+// getLogger().log(DEBUG,"Receiving prepare("+arg0+")");
return XA_OK;
}
@@ -182,7 +182,7 @@
* @see javax.transaction.xa.XAResource#recover(int)
*/
public Xid[] recover(int arg0) {
- getTrace().debug("Receiving recover("+arg0+")");
+// getLogger().log(DEBUG,"Receiving recover("+arg0+")");
return null;
}
@@ -190,14 +190,14 @@
* @see
javax.transaction.xa.XAResource#rollback(javax.transaction.xa.Xid)
*/
public void rollback(Xid arg0) {
- getTrace().debug("Receiving rollback("+arg0+")");
+// getLogger().log(DEBUG,"Receiving rollback("+arg0+")");
}
/* (non-Javadoc)
* @see javax.transaction.xa.XAResource#setTransactionTimeout(int)
*/
public boolean setTransactionTimeout(int arg0) {
- getTrace().debug("Receiving setTransactionTimeout("+arg0+")");
+// getLogger().log(DEBUG,"Receiving setTransactionTimeout("+arg0+")");
return false;
}
@@ -205,7 +205,7 @@
* @see javax.transaction.xa.XAResource#start(javax.transaction.xa.Xid,
int)
*/
public void start(Xid arg0, int arg1) {
- getTrace().debug("Receiving start("+arg0+", "+arg1+")");
+// getLogger().log(DEBUG,"Receiving start("+arg0+", "+arg1+")");
}
}
Index:
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/JtaClient.java
diff -u
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/JtaClient.java:1.3
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/JtaClient.java:1.4
---
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/JtaClient.java:1.3
Tue Apr 19 11:38:09 2005
+++
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/JtaClient.java
Mon May 23 13:21:00 2005
@@ -22,7 +22,7 @@
Contributor(s): ______________________________________.
---------------------------------------------------------------------
- $Id: JtaClient.java,v 1.3 2005/04/19 09:38:09 rouvoy Exp $
+ $Id: JtaClient.java,v 1.4 2005/05/23 11:21:00 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.jts.benchmark;
@@ -30,10 +30,8 @@
import java.util.HashMap;
import java.util.Map;
-import javax.naming.NamingException;
import javax.transaction.TransactionManager;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.lib.BindablePrimitive;
import org.objectweb.gotm.jts.benchmark.tools.Collector;
import org.objectweb.gotm.jts.benchmark.tools.Scenario;
@@ -42,8 +40,8 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 3 janv. 2005
- * @modified $Date: 2005/04/19 09:38:09 $
- * @version $Revision: 1.3 $
+ * @modified $Date: 2005/05/23 11:21:00 $
+ * @version $Revision: 1.4 $
* @fractal.itf name="runnable" signature="java.lang.Runnable"
* @fractal.itf name="transaction-manager" role="client"
signature="javax.transaction.TransactionManager"
* @fractal.itf name="scenario" role="client"
signature="org.objectweb.gotm.jts.benchmark.tools.Scenario"
@@ -63,7 +61,7 @@
}
/**
- * @fractal.attr value="10"
+ * @fractal.attr value="1000"
*/
private int iterations ;
@@ -87,24 +85,14 @@
* @return the associated transaction manager.
*/
protected TransactionManager getTransactionManager() {
- try {
- return (TransactionManager) lookupFc(TX_MANAGER);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
+ return (TransactionManager) fcBindings.get(TX_MANAGER);
}
/**
* @return the associated scenario.
*/
protected Scenario getScenario() {
- try {
- return (Scenario) lookupFc(Scenario.SCENARIO);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
+ return (Scenario) fcBindings.get(Scenario.SCENARIO);
}
@@ -115,24 +103,24 @@
private Collector run(TransactionManager tm) {
Map config = new HashMap();
config.put("tm",tm);
-
- for (int nb=500 ; nb<=5000 ; nb+=500) {
+// int nb = 5;
+ for (int nb=5000 ; nb<=50000 ; nb+=5000) {
Collector collect = new Collector();
config.put("collector", collect);
config.put("nb", new Integer(nb));
- config.put("commit",Boolean.valueOf(true));
+ config.put("commit",Boolean.FALSE);
getScenario().init(config);
for (int i=0 ; i < getIterations() ; i++) {
getScenario().run();
}
- config.put("commit",Boolean.valueOf(false));
+ config.put("commit",Boolean.TRUE);
getScenario().init(config);
for (int i=0 ; i < getIterations() ; i++) {
getScenario().run();
}
- System.out.println("Results for "+nb+": "+collect);
+ System.out.println("* Results for "+nb+":\n"+collect);
}
return null;
}
@@ -142,25 +130,23 @@
*/
public void run() {
System.out.println("Running Scenarios:");
+
System.out.println("GoTM:");
run(getTransactionManager());
-// System.out.println("JOTM:");
-// run(this.jotm.getTransactionManager());
-// this.jotm.stop();
- System.exit(0);
- }
-
- /**
- * Default Constructor.
- */
- public JtaClient() {
+
+ System.out.println("JOTM:");
try {
- this.jotm = new Jotm(true,false);
+ this.jotm = new Jotm(true, false);
} catch (NamingException e) {
e.printStackTrace();
}
+ run(this.jotm.getTransactionManager());
+ this.jotm.stop();
+
+// run(null);
+ System.exit(0);
}
-
+
/**
* @param args command line arguments
*/
Index:
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/TransactionScenarioImpl.java
diff -u
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/TransactionScenarioImpl.java:1.2
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/TransactionScenarioImpl.java:1.3
---
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/TransactionScenarioImpl.java:1.2
Tue Apr 19 11:38:09 2005
+++
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/TransactionScenarioImpl.java
Mon May 23 13:21:00 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: TransactionScenarioImpl.java,v 1.2 2005/04/19 09:38:09 rouvoy Exp $
+$Id: TransactionScenarioImpl.java,v 1.3 2005/05/23 11:21:00 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.jts.benchmark;
@@ -35,12 +35,7 @@
import javax.transaction.xa.XAResource;
import org.objectweb.fractal.api.Component;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
-import org.objectweb.fractal.api.control.IllegalLifeCycleException;
-import org.objectweb.fractal.api.factory.Factory;
-import org.objectweb.fractal.api.factory.InstantiationException;
import org.objectweb.fractal.lib.BindablePrimitive;
-import org.objectweb.fractal.util.Fractal;
import org.objectweb.gotm.jts.benchmark.tools.Collector;
import org.objectweb.gotm.jts.benchmark.tools.Scenario;
import org.objectweb.gotm.jts.benchmark.tools.Timer;
@@ -48,8 +43,8 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 24 janv. 2005
- * @modified $Date: 2005/04/19 09:38:09 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/05/23 11:21:00 $
+ * @version $Revision: 1.3 $
* @fractal.itf name="counter" role="client"
signature="org.objectweb.fractal.api.Component"
*/
public class TransactionScenarioImpl
@@ -57,7 +52,7 @@
implements Scenario, TransactionScenarioAttributeController
{
/**
- * @fractal.attr value="5000"
+ * @fractal.attr value="5"
*/
private int components ;
@@ -92,21 +87,9 @@
protected void init(int nb) {
- try {
- Factory fct = (Factory)
((Component)lookupFc(Counter.COUNTER)).getFcInterface("factory");
-// if (c >= this.counters.size())
- this.counters.clear();
- for (int i=0;i<=nb;i++) {
- Component counter = fct.newFcInstance();
- Fractal.getLifeCycleController(counter).startFc();
- this.counters.add(counter);
- }
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- } catch (InstantiationException e) {
- getTrace().debug(e.getMessage());
- } catch (IllegalLifeCycleException e) {
- getTrace().debug(e.getMessage());
+ for (int i=0;i<=nb;i++) {
+ Counter counter = new CounterImpl();
+ this.counters.add(counter);
}
}
/**
@@ -122,12 +105,7 @@
* @return the associated counter.
*/
protected Counter getCounter(int c) {
- try {
- return (Counter) getComponent(c).getFcInterface(Counter.COUNTER);
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- return null ;
- }
+ return (Counter) this.counters.get(c);
}
/**
@@ -135,12 +113,7 @@
* @return the associated synchronization object.
*/
protected Synchronization getSynchronization(int c) {
- try {
- return (Synchronization)
getComponent(c).getFcInterface("synchronization");
- } catch (NoSuchInterfaceException e) {
- e.printStackTrace();
- return null ;
- }
+ return (Synchronization) this.counters.get(c);
}
/**
@@ -148,12 +121,7 @@
* @return the associated XA resource object.
*/
protected XAResource getXAResource(int c) {
- try {
- return (XAResource)
getComponent(c).getFcInterface("xa-resource");
- } catch (NoSuchInterfaceException e) {
- e.printStackTrace();
- return null ;
- }
+ return (XAResource) this.counters.get(c);
}
@@ -175,16 +143,16 @@
* @param nb
*/
public void go(int nb) {
- this.timer.start();
try {
+ this.timer.start();
tm.begin();
+// this.timer.stop();
+// collect.collect("begin()",this.timer.display());
} catch (Exception e) {
e.printStackTrace();
}
- this.timer.stop();
- collect.collect("begin()",this.timer.display());
- this.timer.start();
+// this.timer.start();
for (int c=0 ; c < nb ; c++) {
try {
tm.getTransaction().registerSynchronization(getSynchronization(c));
@@ -194,25 +162,25 @@
getCounter(c).incr();
getCounter(c).value(); // simulates counter access.
}
- this.timer.stop();
- collect.collect("registerSynchronization()",this.timer.display());
+// this.timer.stop();
+// collect.collect("registerSynchronization()",this.timer.display());
if (commit) {
- this.timer.start();
try {
+// this.timer.start();
tm.commit();
+ this.timer.stop();
} catch (Exception e) {
e.printStackTrace();
}
- this.timer.stop();
} else {
- this.timer.start();
try {
+// this.timer.start();
tm.rollback();
+ this.timer.stop();
} catch (Exception e) {
e.printStackTrace();
}
- this.timer.stop();
}
collect.collect(commit?"commit()":"rollback()",this.timer.display());
}
Index:
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Collector.java
diff -u
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Collector.java:1.2
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Collector.java:1.3
---
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Collector.java:1.2
Tue Apr 19 11:38:09 2005
+++
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Collector.java
Mon May 23 13:21:00 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: Collector.java,v 1.2 2005/04/19 09:38:09 rouvoy Exp $
+$Id: Collector.java,v 1.3 2005/05/23 11:21:00 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.jts.benchmark.tools;
@@ -34,8 +34,8 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 21 janv. 2005
- * @modified $Date: 2005/04/19 09:38:09 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/05/23 11:21:00 $
+ * @version $Revision: 1.3 $
*/
public class Collector {
/** <code>measures</code> . */
@@ -85,7 +85,7 @@
*/
public void visitSerie(String serie, SerieVisitor visitor) {
//System.err.println("Visiting the serie "+serie);
- getSerie(serie).visit(visitor);
+ getSerie(serie).accept(visitor);
}
/* (non-Javadoc)
Index:
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Serie.java
diff -u
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Serie.java:1.2
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Serie.java:1.3
---
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Serie.java:1.2
Tue Apr 19 11:38:09 2005
+++
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Serie.java
Mon May 23 13:21:00 2005
@@ -23,7 +23,7 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: Serie.java,v 1.2 2005/04/19 09:38:09 rouvoy Exp $
+$Id: Serie.java,v 1.3 2005/05/23 11:21:00 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.jts.benchmark.tools;
@@ -33,8 +33,8 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 21 janv. 2005
- * @modified $Date: 2005/04/19 09:38:09 $
- * @version $Revision: 1.2 $
+ * @modified $Date: 2005/05/23 11:21:00 $
+ * @version $Revision: 1.3 $
*/
public class Serie {
private final Vector data ;
@@ -58,23 +58,43 @@
/**
* @param visitor the visitor to apply.
*/
- public void visit(SerieVisitor visitor) {
+ public void accept(SerieVisitor visitor) {
visitor.setName(this.topic);
for (Iterator i = this.data.iterator() ; i.hasNext() ; ) {
visitor.accept((Number)i.next());
}
}
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
+ /**
+ * @return the list of values.
*/
- public String toString() {
+ public String values() {
StringBuffer buffer = new StringBuffer(this.topic+": [");
for (Iterator i = this.data.iterator() ; i.hasNext() ; ) {
buffer.append(i.next().toString());
if (i.hasNext()) buffer.append("; ");
}
- buffer.append("]");
+ return buffer.toString()+"]";
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer(this.topic+": ");
+ SerieVisitor v = new SerieMin();
+// accept(v);
+// v.setName(" MIN");
+// buffer.append(v.compute().values());
+ v = new SerieAverage();
+ accept(v);
+ v.setName(" AVG");
+ buffer.append(v.compute().values());
+ v = new SerieMax();
+ accept(v);
+ v.setName(" MAX");
+ buffer.append(v.compute().values());
+// buffer.append(values());
return buffer.toString();
}
}
Index:
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/SerieMin.java
diff -u
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/SerieMin.java:1.1
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/SerieMin.java:1.2
---
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/SerieMin.java:1.1
Wed Feb 23 18:39:46 2005
+++
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/SerieMin.java
Mon May 23 13:21:00 2005
@@ -23,15 +23,15 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: SerieMin.java,v 1.1 2005/02/23 17:39:46 rouvoy Exp $
+$Id: SerieMin.java,v 1.2 2005/05/23 11:21:00 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.jts.benchmark.tools;
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 21 janv. 2005
- * @modified $Date: 2005/02/23 17:39:46 $
- * @version $Revision: 1.1 $
+ * @modified $Date: 2005/05/23 11:21:00 $
+ * @version $Revision: 1.2 $
*/
public class SerieMin
extends VisitorImpl {
@@ -57,4 +57,6 @@
s.collect(this.min);
return s;
}
+
+
}
Index:
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Timer.java
diff -u
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Timer.java:1.1
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Timer.java:1.2
---
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Timer.java:1.1
Wed Feb 23 18:39:46 2005
+++
gotm-jts/example/benchmark/src/java/org/objectweb/gotm/jts/benchmark/tools/Timer.java
Mon May 23 13:21:00 2005
@@ -23,20 +23,20 @@
Contributor(s): .
---------------------------------------------------------------------
-$Id: Timer.java,v 1.1 2005/02/23 17:39:46 rouvoy Exp $
+$Id: Timer.java,v 1.2 2005/05/23 11:21:00 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.jts.benchmark.tools;
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 11 janv. 2005
- * @modified $Date: 2005/02/23 17:39:46 $
- * @version $Revision: 1.1 $
+ * @modified $Date: 2005/05/23 11:21:00 $
+ * @version $Revision: 1.2 $
*/
public class Timer {
private long time = 0;
- private boolean progress = true;
+ private boolean progress = false;
/**
Index:
gotm-jts/example/local/src/java/org/objectweb/gotm/jts/local/CounterImpl.java
diff -u
gotm-jts/example/local/src/java/org/objectweb/gotm/jts/local/CounterImpl.java:1.4
gotm-jts/example/local/src/java/org/objectweb/gotm/jts/local/CounterImpl.java:1.5
---
gotm-jts/example/local/src/java/org/objectweb/gotm/jts/local/CounterImpl.java:1.4
Thu Jan 20 12:48:45 2005
+++
gotm-jts/example/local/src/java/org/objectweb/gotm/jts/local/CounterImpl.java
Mon May 23 13:21:00 2005
@@ -22,7 +22,7 @@
Contributor(s): ______________________________________.
---------------------------------------------------------------------
- $Id: CounterImpl.java,v 1.4 2005/01/20 11:48:45 rouvoy Exp $
+ $Id: CounterImpl.java,v 1.5 2005/05/23 11:21:00 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.jts.local;
@@ -39,8 +39,8 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 3 janv. 2005
- * @modified $Date: 2005/01/20 11:48:45 $
- * @version $Revision: 1.4 $
+ * @modified $Date: 2005/05/23 11:21:00 $
+ * @version $Revision: 1.5 $
* @fractal.itf name="synchronization" role="server"
signature="javax.transaction.Synchronization"
* @fractal.itf name="xa-resource" role="server"
signature="javax.transaction.xa.XAResource"
*/
@@ -70,14 +70,14 @@
* @see javax.transaction.Synchronization#beforeCompletion()
*/
public void beforeCompletion() {
- getTrace().info("Receiving beforeCompletion()...");
+ getLogger().log(INFO,"Receiving beforeCompletion()...");
}
/* (non-Javadoc)
* @see javax.transaction.Synchronization#afterCompletion(int)
*/
public void afterCompletion(int arg0) {
- getTrace().info("Receiving afterCompletion("+arg0+")...");
+ getLogger().log(INFO,"Receiving afterCompletion("+arg0+")...");
if (arg0 == Status.STATUS_COMMITTED) {
this.counter += this.clone ;
}
@@ -127,28 +127,28 @@
* @see javax.transaction.xa.XAResource#commit(javax.transaction.xa.Xid,
boolean)
*/
public void commit(Xid arg0, boolean arg1) {
- getTrace().debug("Receiving setTransactionTimeout("+arg0+")");
+ getLogger().log(DEBUG,"Receiving setTransactionTimeout("+arg0+")");
}
/* (non-Javadoc)
* @see javax.transaction.xa.XAResource#end(javax.transaction.xa.Xid,
int)
*/
public void end(Xid arg0, int arg1) {
- getTrace().debug("Receiving end("+arg0+", "+arg1+")");
+ getLogger().log(DEBUG,"Receiving end("+arg0+", "+arg1+")");
}
/* (non-Javadoc)
* @see javax.transaction.xa.XAResource#forget(javax.transaction.xa.Xid)
*/
public void forget(Xid arg0) {
- getTrace().debug("Receiving forget("+arg0+")");
+ getLogger().log(DEBUG,"Receiving forget("+arg0+")");
}
/* (non-Javadoc)
* @see javax.transaction.xa.XAResource#getTransactionTimeout()
*/
public int getTransactionTimeout() {
- getTrace().debug("Receiving getTransactionTimeout()");
+ getLogger().log(DEBUG,"Receiving getTransactionTimeout()");
return 0;
}
@@ -156,7 +156,7 @@
* @see
javax.transaction.xa.XAResource#isSameRM(javax.transaction.xa.XAResource)
*/
public boolean isSameRM(XAResource arg0) {
- getTrace().debug("Receiving setTransactionTimeout("+arg0+")");
+ getLogger().log(DEBUG,"Receiving setTransactionTimeout("+arg0+")");
return false;
}
@@ -164,7 +164,7 @@
* @see javax.transaction.xa.XAResource#prepare(javax.transaction.xa.Xid)
*/
public int prepare(Xid arg0) {
- getTrace().debug("Receiving prepare("+arg0+")");
+ getLogger().log(DEBUG,"Receiving prepare("+arg0+")");
return XA_OK;
}
@@ -172,7 +172,7 @@
* @see javax.transaction.xa.XAResource#recover(int)
*/
public Xid[] recover(int arg0) {
- getTrace().debug("Receiving recover("+arg0+")");
+ getLogger().log(DEBUG,"Receiving recover("+arg0+")");
return null;
}
@@ -180,14 +180,14 @@
* @see
javax.transaction.xa.XAResource#rollback(javax.transaction.xa.Xid)
*/
public void rollback(Xid arg0) {
- getTrace().debug("Receiving rollback("+arg0+")");
+ getLogger().log(DEBUG,"Receiving rollback("+arg0+")");
}
/* (non-Javadoc)
* @see javax.transaction.xa.XAResource#setTransactionTimeout(int)
*/
public boolean setTransactionTimeout(int arg0) {
- getTrace().debug("Receiving setTransactionTimeout("+arg0+")");
+ getLogger().log(DEBUG,"Receiving setTransactionTimeout("+arg0+")");
return false;
}
@@ -195,7 +195,7 @@
* @see javax.transaction.xa.XAResource#start(javax.transaction.xa.Xid,
int)
*/
public void start(Xid arg0, int arg1) {
- getTrace().debug("Receiving start("+arg0+", "+arg1+")");
+ getLogger().log(DEBUG,"Receiving start("+arg0+", "+arg1+")");
}
}
Index:
gotm-jts/example/local/src/java/org/objectweb/gotm/jts/local/JtaClient.java
diff -u
gotm-jts/example/local/src/java/org/objectweb/gotm/jts/local/JtaClient.java:1.4
gotm-jts/example/local/src/java/org/objectweb/gotm/jts/local/JtaClient.java:1.5
---
gotm-jts/example/local/src/java/org/objectweb/gotm/jts/local/JtaClient.java:1.4
Thu Jan 20 12:48:45 2005
+++
gotm-jts/example/local/src/java/org/objectweb/gotm/jts/local/JtaClient.java
Mon May 23 13:21:00 2005
@@ -22,7 +22,7 @@
Contributor(s): ______________________________________.
---------------------------------------------------------------------
- $Id: JtaClient.java,v 1.4 2005/01/20 11:48:45 rouvoy Exp $
+ $Id: JtaClient.java,v 1.5 2005/05/23 11:21:00 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.jts.local;
@@ -44,8 +44,8 @@
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 3 janv. 2005
- * @modified $Date: 2005/01/20 11:48:45 $
- * @version $Revision: 1.4 $
+ * @modified $Date: 2005/05/23 11:21:00 $
+ * @version $Revision: 1.5 $
* @fractal.itf name="runnable" signature="java.lang.Runnable"
* @fractal.itf name="transaction-manager" role="client"
signature="javax.transaction.TransactionManager"
* @fractal.itf name="counter" role="client"
signature="org.objectweb.fractal.api.Component"
@@ -68,12 +68,7 @@
* @return the associated transaction manager.
*/
protected TransactionManager getTransactionManager() {
- try {
- return (TransactionManager) lookupFc(TX_MANAGER);
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- return null;
- }
+ return (TransactionManager) fcBindings.get(TX_MANAGER);
}
/**
@@ -81,9 +76,8 @@
*/
protected Counter getCounter() {
try {
- return (Counter)
((Component)lookupFc(Counter.COUNTER)).getFcInterface(Counter.COUNTER);
+ return (Counter)
((Component)fcBindings.get(Counter.COUNTER)).getFcInterface(Counter.COUNTER);
} catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
return null ;
}
}
@@ -93,9 +87,8 @@
*/
protected Synchronization getSynchronization() {
try {
- return (Synchronization)
((Component)lookupFc(Counter.COUNTER)).getFcInterface("synchronization");
+ return (Synchronization)
((Component)fcBindings.get(Counter.COUNTER)).getFcInterface("synchronization");
} catch (NoSuchInterfaceException e) {
- e.printStackTrace();
return null ;
}
}
@@ -105,9 +98,8 @@
*/
protected XAResource getXAResource() {
try {
- return (XAResource)
((Component)lookupFc(Counter.COUNTER)).getFcInterface("xa-resource");
+ return (XAResource)
((Component)fcBindings.get(Counter.COUNTER)).getFcInterface("xa-resource");
} catch (NoSuchInterfaceException e) {
- e.printStackTrace();
return null ;
}
}
@@ -117,13 +109,13 @@
*
*/
protected void commit() {
- getTrace().info("==> Testing Commit");
- getTrace().info("Counter == "+getCounter().value());
- getTrace().info("Beginning a transaction");
+ getLogger().log(INFO,"==> Testing Commit");
+ getLogger().log(INFO,"Counter == "+getCounter().value());
+ getLogger().log(INFO,"Beginning a transaction");
try {
getTransactionManager().begin();
try {
- getTrace().info("Registering synchronization");
+ getLogger().log(INFO,"Registering synchronization");
getTransactionManager().getTransaction().registerSynchronization(getSynchronization());
getTransactionManager().getTransaction().enlistResource(getXAResource());
} catch (IllegalStateException e2) {
@@ -131,16 +123,16 @@
} catch (RollbackException e2) {
e2.printStackTrace();
}
- getTrace().info("Applying modifications");
+ getLogger().log(INFO,"Applying modifications");
} catch (NotSupportedException e) {
e.printStackTrace();
} catch (SystemException e) {
e.printStackTrace();
}
getCounter().incr();
- getTrace().info("Counter == "+getCounter().value());
+ getLogger().log(INFO,"Counter == "+getCounter().value());
try {
- getTrace().info("Committing the transaction");
+ getLogger().log(INFO,"Committing the transaction");
getTransactionManager().commit();
} catch (SecurityException e1) {
e1.printStackTrace();
@@ -155,20 +147,20 @@
} catch (SystemException e1) {
e1.printStackTrace();
}
- getTrace().info("Counter == "+getCounter().value());
+ getLogger().log(INFO,"Counter == "+getCounter().value());
}
/**
*
*/
protected void rollback() {
- getTrace().info("==> Testing Rollback");
- getTrace().info("Counter == "+getCounter().value());
- getTrace().info("Beginning a transaction");
+ getLogger().log(INFO,"==> Testing Rollback");
+ getLogger().log(INFO,"Counter == "+getCounter().value());
+ getLogger().log(INFO,"Beginning a transaction");
try {
getTransactionManager().begin();
try {
- getTrace().info("Registering synchronization");
+ getLogger().log(INFO,"Registering synchronization");
getTransactionManager().getTransaction().registerSynchronization(getSynchronization());
getTransactionManager().getTransaction().enlistResource(getXAResource());
} catch (IllegalStateException e2) {
@@ -176,16 +168,16 @@
} catch (RollbackException e2) {
e2.printStackTrace();
}
- getTrace().info("Applying modifications");
+ getLogger().log(INFO,"Applying modifications");
} catch (NotSupportedException e) {
e.printStackTrace();
} catch (SystemException e) {
e.printStackTrace();
}
getCounter().incr();
- getTrace().info("Counter == "+getCounter().value());
+ getLogger().log(INFO,"Counter == "+getCounter().value());
try {
- getTrace().info("Rolling back the transaction");
+ getLogger().log(INFO,"Rolling back the transaction");
getTransactionManager().rollback();
} catch (SecurityException e1) {
e1.printStackTrace();
@@ -194,7 +186,7 @@
} catch (SystemException e) {
e.printStackTrace();
}
- getTrace().info("Counter == "+getCounter().value());
+ getLogger().log(INFO,"Counter == "+getCounter().value());
}
/* (non-Javadoc)
@@ -202,9 +194,9 @@
*/
public void run() {
System.out.println("** JTA Client **");
- getTrace().info("Starting the client");
+ getLogger().log(INFO,"Starting the client");
commit();
rollback();
- getTrace().info("Stopping the client");
+ getLogger().log(INFO,"Stopping the client");
}
}
Index: gotm-jts/src/fractal/org/objectweb/gotm/lib/TpActivationImpl.fractal
diff -u
gotm-jts/src/fractal/org/objectweb/gotm/lib/TpActivationImpl.fractal:1.1
gotm-jts/src/fractal/org/objectweb/gotm/lib/TpActivationImpl.fractal:removed
--- gotm-jts/src/fractal/org/objectweb/gotm/lib/TpActivationImpl.fractal:1.1
Wed Feb 23 18:39:46 2005
+++ gotm-jts/src/fractal/org/objectweb/gotm/lib/TpActivationImpl.fractal
Mon May 23 13:21:01 2005
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC
- "-//objectweb.org//DTD Fractal ADL 2.0//EN"
- "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
-
-<definition name="org.objectweb.gotm.lib.TpActivationImpl">
- <interface name="tx-activation" role="server"
-
signature="org.objectweb.transaction.api.transaction.TransactionActivationFeature"/>
-
- <component name="FcState"
-
definition="org.objectweb.gotm.lib.transaction.TpTransactionStateImpl"/>
- <component name="FcActivate"
-
definition="org.objectweb.gotm.lib.transaction.TpTransactionActivationFeatureImpl"/>
-
- <binding client="this.tx-activation"
- server="FcActivate.tx-activation"/>
- <binding client="FcActivate.tx-state"
- server="FcState.tx-state"/>
-
- <template-controller desc="compositeTemplate" />
-</definition>
Index: gotm-jts/src/fractal/org/objectweb/gotm/lib/TpCoordinatorImpl.fractal
diff -u
gotm-jts/src/fractal/org/objectweb/gotm/lib/TpCoordinatorImpl.fractal:1.1
gotm-jts/src/fractal/org/objectweb/gotm/lib/TpCoordinatorImpl.fractal:removed
--- gotm-jts/src/fractal/org/objectweb/gotm/lib/TpCoordinatorImpl.fractal:1.1
Wed Feb 23 18:39:46 2005
+++ gotm-jts/src/fractal/org/objectweb/gotm/lib/TpCoordinatorImpl.fractal
Mon May 23 13:21:01 2005
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC
- "-//objectweb.org//DTD Fractal ADL 2.0//EN"
- "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
-
-<definition name="org.objectweb.gotm.lib.TpCoordinatorImpl">
- <interface name="subscribe" role="server"
- signature="org.objectweb.transaction.api.event.SubscribeFeature"/>
- <interface name="publish" role="server"
- signature="org.objectweb.transaction.api.event.PublishFeature"/>
-
- <component name="FcTopics"
- definition="org.objectweb.gotm.lib.event.TpEventEngineSimple"/>
-
-<!--
- <component name="FcTopics"
- definition="org.objectweb.gotm.lib.event.TpEventEngineThreadPool"/>
- <component name="FcThread"
- definition="org.objectweb.util.thread.comp.TpThreadManager(10,100)"/>
- <binding client="FcTopics.runnable-manager"
- server="FcThread.runnable-manager"/>
--->
-
- <binding client="this.subscribe"
- server="FcTopics.subscribe"/>
- <binding client="this.publish"
- server="FcTopics.publish"/>
-
- <template-controller desc="compositeTemplate" />
-</definition>
Index: gotm-jts/src/fractal/org/objectweb/gotm/lib/TpInterruptionImpl.fractal
diff -u
gotm-jts/src/fractal/org/objectweb/gotm/lib/TpInterruptionImpl.fractal:1.1
gotm-jts/src/fractal/org/objectweb/gotm/lib/TpInterruptionImpl.fractal:removed
---
gotm-jts/src/fractal/org/objectweb/gotm/lib/TpInterruptionImpl.fractal:1.1
Wed Feb 23 18:39:46 2005
+++ gotm-jts/src/fractal/org/objectweb/gotm/lib/TpInterruptionImpl.fractal
Mon May 23 13:21:01 2005
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE definition PUBLIC
- "-//objectweb.org//DTD Fractal ADL 2.0//EN"
- "classpath://org/objectweb/fractal/adl/xml/basic.dtd">
-
-<definition name="org.objectweb.gotm.lib.TpInterruptionImpl">
- <interface name="tx-interruption" role="server"
-
signature="org.objectweb.transaction.api.transaction.TransactionInterruptionFeature"/>
-
- <component name="FcState"
-
definition="org.objectweb.gotm.lib.transaction.TpTransactionStateImpl"/>
- <component name="FcInterrupt"
-
definition="org.objectweb.gotm.lib.transaction.TpTransactionInterruptionFeatureImpl"/>
-
- <binding client="this.tx-interruption"
- server="FcInterrupt.tx-interruption"/>
- <binding client="FcInterrupt.tx-state"
- server="FcState.tx-state"/>
-
- <template-controller desc="compositeTemplate" />
-</definition>
Index: gotm-jts/src/fractal/org/objectweb/gotm/lib/TpJTSImpl.fractal
diff -u gotm-jts/src/fractal/org/objectweb/gotm/lib/TpJTSImpl.fractal:1.1
gotm-jts/src/fractal/org/objectweb/gotm/lib/TpJTSImpl.fractal:1.2
--- gotm-jts/src/fractal/org/objectweb/gotm/lib/TpJTSImpl.fractal:1.1 Wed
Feb 23 18:39:46 2005
+++ gotm-jts/src/fractal/org/objectweb/gotm/lib/TpJTSImpl.fractal Mon
May 23 13:21:01 2005
@@ -9,7 +9,7 @@
<interface name="user-transaction" role="server"
signature="javax.transaction.UserTransaction"/>
- <component name="FcAdapter"
+ <component name="FcAdapter"
definition="org.objectweb.gotm.lib.jta.TpTransactionImpl"/>
<component name="FcGoTM"
definition="org.objectweb.gotm.lib.TpTransactionImpl"/>
@@ -25,12 +25,6 @@
<binding client="FcAdapter.tx-state"
server="FcGoTM.tx-state"/>
- <binding client="FcAdapter.tx-status"
- server="FcGoTM.tx-status"/>
- <binding client="FcAdapter.tx-activation"
- server="FcGoTM.tx-activation"/>
- <binding client="FcAdapter.tx-interruption"
- server="FcGoTM.tx-interruption"/>
<binding client="FcAdapter.synchronization"
server="FcResource.synchronization"/>
<binding client="FcAdapter.xa-resource"
Index: gotm-jts/src/fractal/org/objectweb/gotm/lib/TpManagerImpl.fractal
diff -u gotm-jts/src/fractal/org/objectweb/gotm/lib/TpManagerImpl.fractal:1.1
gotm-jts/src/fractal/org/objectweb/gotm/lib/TpManagerImpl.fractal:1.2
--- gotm-jts/src/fractal/org/objectweb/gotm/lib/TpManagerImpl.fractal:1.1
Wed Feb 23 18:39:46 2005
+++ gotm-jts/src/fractal/org/objectweb/gotm/lib/TpManagerImpl.fractal Mon
May 23 13:21:01 2005
@@ -8,30 +8,32 @@
signature="org.objectweb.transaction.api.transaction.TransactionState"/>
<interface name="tx-status" role="server"
signature="org.objectweb.transaction.api.transaction.TransactionStatusFeature"/>
- <interface name="tx-activation" role="server"
+<!-- <interface name="tx-activation" role="server"
signature="org.objectweb.transaction.api.transaction.TransactionActivationFeature"/>
<interface name="tx-interruption" role="server"
signature="org.objectweb.transaction.api.transaction.TransactionInterruptionFeature"/>
-
+-->
<interface name="publish" role="client"
signature="org.objectweb.transaction.api.event.PublishFeature"/>
<component name="FcState"
definition="org.objectweb.gotm.lib.transaction.TpTransactionStateImpl"/>
- <component name="FcActivation"
+<!--
+ <component name="FcActivation"
definition="org.objectweb.gotm.lib.TpActivationImpl">
- <component name="FcState" definition="./FcState"/>
+ <component name="FcState" definition="./FcState"/>
</component>
<component name="FcInterruption"
definition="org.objectweb.gotm.lib.TpInterruptionImpl">
<component name="FcState" definition="./FcState"/>
</component>
-
+-->
<binding client="this.tx-state" server="FcState.tx-state"/>
<binding client="this.tx-status" server="FcState.tx-status"/>
+<!--
<binding client="this.tx-activation"
server="FcActivation.tx-activation"/>
<binding client="this.tx-interruption"
server="FcInterruption.tx-interruption"/>
-
+-->
<binding client="FcState.publish" server="this.publish"/>
<template-controller desc="compositeTemplate" />
Index: gotm-jts/src/fractal/org/objectweb/gotm/lib/TpTransactionImpl.fractal
diff -u
gotm-jts/src/fractal/org/objectweb/gotm/lib/TpTransactionImpl.fractal:1.1
gotm-jts/src/fractal/org/objectweb/gotm/lib/TpTransactionImpl.fractal:1.2
--- gotm-jts/src/fractal/org/objectweb/gotm/lib/TpTransactionImpl.fractal:1.1
Wed Feb 23 18:39:46 2005
+++ gotm-jts/src/fractal/org/objectweb/gotm/lib/TpTransactionImpl.fractal
Mon May 23 13:21:00 2005
@@ -8,38 +8,36 @@
signature="org.objectweb.transaction.api.transaction.TransactionState"/>
<interface name="tx-status" role="server"
signature="org.objectweb.transaction.api.transaction.TransactionStatusFeature"/>
- <interface name="tx-activation" role="server"
-
signature="org.objectweb.transaction.api.transaction.TransactionActivationFeature"/>
<interface name="process-twopc" role="server"
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"/>
<interface name="process-rollback" role="server"
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"/>
- <interface name="tx-interruption" role="server"
-
signature="org.objectweb.transaction.api.transaction.TransactionInterruptionFeature"/>
<interface name="subscribe" role="server"
signature="org.objectweb.transaction.api.event.SubscribeFeature"/>
- <component name="FcManager"
+
+ <component name="TransactionState"
definition="org.objectweb.gotm.lib.TpManagerImpl"/>
- <component name="FcCoordinator"
- definition="org.objectweb.gotm.lib.TpCoordinatorImpl"/>
- <component name="FcTerminator"
- definition="org.objectweb.gotm.lib.TpTerminatorImpl"/>
-
- <binding client="this.tx-state" server="FcManager.tx-state"/>
- <binding client="this.tx-status" server="FcManager.tx-status"/>
- <binding client="this.tx-activation" server="FcManager.tx-activation"/>
- <binding client="this.tx-interruption"
server="FcManager.tx-interruption"/>
- <binding client="this.subscribe" server="FcCoordinator.subscribe"/>
- <binding client="this.process-twopc"
server="FcTerminator.process-twopc"/>
- <binding client="this.process-rollback"
server="FcTerminator.process-rollback"/>
-
- <binding client="FcManager.publish" server="FcCoordinator.publish"/>
-
- <binding client="FcTerminator.publish" server="FcCoordinator.publish"/>
- <binding client="FcTerminator.subscribe" server="FcCoordinator.subscribe"/>
- <binding client="FcTerminator.tx-status" server="FcManager.tx-status"/>
- <binding client="FcTerminator.tx-state" server="FcManager.tx-state"/>
+ <component name="EventBus"
+ definition="org.objectweb.gotm.lib.event.TpEventBus"/>
+ <component name="ValidationProcotol"
+ definition="org.objectweb.gotm.lib.coordination.Tp2PC"/>
+ <component name="AutoAbort"
+
definition="org.objectweb.gotm.lib.coordination.TpAutoAbortImpl(100)"/>
+
+ <binding client="this.tx-state"
server="TransactionState.tx-state"/>
+ <binding client="this.tx-status"
server="TransactionState.tx-status"/>
+ <binding client="this.subscribe" server="EventBus.subscribe"/>
+ <binding client="this.process-twopc"
server="ValidationProcotol.commit"/>
+ <binding client="this.process-rollback" server="ValidationProcotol.abort"/>
+
+ <binding client="TransactionState.publish" server="EventBus.publish"/>
+
+ <binding client="ValidationProcotol.publish" server="EventBus.publish"/>
+ <binding client="ValidationProcotol.tx-state"
server="TransactionState.tx-state"/>
+
+ <binding client="AutoAbort.subscribe" server="EventBus.subscribe"/>
+ <binding client="AutoAbort.coord-process"
server="ValidationProcotol.abort"/>
- <template-controller desc="compositeTemplate"/>
+ <template-controller desc="compositeTemplate"/>
</definition>
Index: gotm-jts/src/java/org/objectweb/gotm/lib/jta/SynchronizationImpl.java
diff -u
gotm-jts/src/java/org/objectweb/gotm/lib/jta/SynchronizationImpl.java:1.4
gotm-jts/src/java/org/objectweb/gotm/lib/jta/SynchronizationImpl.java:1.5
--- gotm-jts/src/java/org/objectweb/gotm/lib/jta/SynchronizationImpl.java:1.4
Wed Feb 23 18:39:45 2005
+++ gotm-jts/src/java/org/objectweb/gotm/lib/jta/SynchronizationImpl.java
Mon May 23 13:21:01 2005
@@ -22,17 +22,17 @@
Contributor(s): ______________________________________.
---------------------------------------------------------------------
- $Id: SynchronizationImpl.java,v 1.4 2005/02/23 17:39:45 rouvoy Exp $
+ $Id: SynchronizationImpl.java,v 1.5 2005/05/23 11:21:01 rouvoy Exp $
====================================================================*/
-
package org.objectweb.gotm.lib.jta;
-
+import java.util.Hashtable;
import java.util.Map;
import javax.transaction.Status;
import javax.transaction.Synchronization;
+import org.objectweb.gotm.lib.resource.Action;
import org.objectweb.gotm.lib.resource.ResourceImpl;
import org.objectweb.transaction.lib.transaction.TransactionStatusCommitted;
import org.objectweb.transaction.lib.transaction.TransactionStatusPrepared;
@@ -43,8 +43,8 @@
* <code>Synchronization</code> object.
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 22 déc. 2004
- * @modified $Date: 2005/02/23 17:39:45 $
- * @version $Revision: 1.4 $
+ * @modified $Date: 2005/05/23 11:21:01 $
+ * @version $Revision: 1.5 $
* @fractal.itf
*/
public class SynchronizationImpl
@@ -52,56 +52,55 @@
{
/** Fractal ADL Identifier for the <code>SynchronizationImpl</code>
class. */
public static final String SYNCHRONIZATION = "synchronization";
-
- private class BeforeCompletion implements Runnable {
- private Synchronization synchronization;
- /**
- * @param sync
- */
- public BeforeCompletion(Synchronization sync) {
- this.synchronization = sync ;
- }
- public void run() {
- this.synchronization.beforeCompletion();
+
+ /**
+ * BeforeCompletion action.
+ */
+ private static final class BeforeCompletion implements Action {
+ public void execute(final Map context, final Object resource) throws
Exception {
+ ((Synchronization)resource).beforeCompletion();
}
}
- private class AfterCompletion implements Runnable {
+
+ /**
+ * AfterCompletion action.
+ */
+ private static final class AfterCompletion implements Action {
private int status ;
- private Synchronization synchronization;
/**
- * @param sync
- * @param status
+ * @param s
*/
- public AfterCompletion(Synchronization sync,int status) {
- this.synchronization = sync ;
- this.status = status;
- }
- public void run() {
- this.synchronization.afterCompletion(this.status);
- }
+ public AfterCompletion(int s) { this.status = s; }
+ /* (non-Javadoc)
+ * @see
org.objectweb.gotm.lib.resource.Action#execute(java.util.Map,
java.lang.Object)
+ */
+ public void execute(final Map context, final Object resource) throws
Exception {
+ ((Synchronization)resource).afterCompletion(this.status);
}
-
- /* (non-Javadoc)
- * @see
org.objectweb.gotm.lib.resource.ResourceWithPool#configureAction(java.lang.String,
java.util.Map, java.lang.Object)
- */
- protected Runnable configureAction(String topic, Map context, Object
resource) {
- if (topic.equals(TransactionStatusPrepared.status.getLabel()))
- return new BeforeCompletion((Synchronization)resource);
- else if (topic.equals(TransactionStatusCommitted.status.getLabel()))
- return new
AfterCompletion((Synchronization)resource,Status.STATUS_COMMITTED);
- else if (topic.equals(TransactionStatusRolledBack.status.getLabel()))
- return new
AfterCompletion((Synchronization)resource,Status.STATUS_ROLLEDBACK);
- throw new RuntimeException("No Action available for "+topic);
}
/* (non-Javadoc)
* @see org.objectweb.gotm.lib.event.SubscribablePrimitive#getEvents()
*/
- protected String[] getEvents() {
- return new String[] {
- TransactionStatusPrepared.status.getLabel(),
- TransactionStatusCommitted.status.getLabel(),
- TransactionStatusRolledBack.status.getLabel()
+ protected int[] getEvents() {
+ return new int[] {
+ TransactionStatusPrepared.status.hashCode(),
+ TransactionStatusCommitted.status.hashCode(),
+ TransactionStatusRolledBack.status.hashCode()
};
+ }
+
+ /* (non-Javadoc)
+ * @see org.objectweb.gotm.lib.resource.ResourceImpl#declareActions()
+ */
+ protected Hashtable declareActions() {
+ Hashtable a = new Hashtable();
+ a.put(TransactionStatusPrepared.status.getValue(),
+ new BeforeCompletion());
+ a.put(TransactionStatusCommitted.status.getValue(),
+ new AfterCompletion(Status.STATUS_COMMITTED));
+ a.put(TransactionStatusRolledBack.status.getValue(),
+ new AfterCompletion(Status.STATUS_ROLLEDBACK));
+ return a;
}
}
Index: gotm-jts/src/java/org/objectweb/gotm/lib/jta/TransactionImpl.java
diff -u gotm-jts/src/java/org/objectweb/gotm/lib/jta/TransactionImpl.java:1.4
gotm-jts/src/java/org/objectweb/gotm/lib/jta/TransactionImpl.java:1.5
--- gotm-jts/src/java/org/objectweb/gotm/lib/jta/TransactionImpl.java:1.4
Wed Feb 23 18:39:45 2005
+++ gotm-jts/src/java/org/objectweb/gotm/lib/jta/TransactionImpl.java Mon
May 23 13:21:01 2005
@@ -22,7 +22,7 @@
Contributor(s): ______________________________________.
---------------------------------------------------------------------
- $Id: TransactionImpl.java,v 1.4 2005/02/23 17:39:45 rouvoy Exp $
+ $Id: TransactionImpl.java,v 1.5 2005/05/23 11:21:01 rouvoy Exp $
====================================================================*/
package org.objectweb.gotm.lib.jta;
@@ -32,7 +32,6 @@
import javax.transaction.UserTransaction;
import javax.transaction.xa.XAResource;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
import org.objectweb.fractal.lib.BindablePrimitive;
import org.objectweb.gotm.lib.event.EventConverter;
import org.objectweb.gotm.lib.resource.Resource;
@@ -40,23 +39,21 @@
import
org.objectweb.transaction.api.transaction.TransactionActivationFeature;
import
org.objectweb.transaction.api.transaction.TransactionInterruptionFeature;
import org.objectweb.transaction.api.transaction.TransactionState;
-import org.objectweb.transaction.api.transaction.TransactionStatusFeature;
import
org.objectweb.transaction.lib.transaction.TransactionStatusMarkedRollback;
+import
org.objectweb.transaction.lib.transaction.TransactionStatusTransactionActive;
/**
+ * Adapter for the Java Transaction API (JTA).
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 24 déc. 2004
- * @modified $Date: 2005/02/23 17:39:45 $
- * @version $Revision: 1.4 $
+ * @modified $Date: 2005/05/23 11:21:01 $
+ * @version $Revision: 1.5 $
* @fractal.itf name="transaction" signature="javax.transaction.Transaction"
* @fractal.itf name="user-transaction"
signature="javax.transaction.UserTransaction"
* @fractal.itf name="commit" role="client"
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"
* @fractal.itf name="rollback" role="client"
signature="org.objectweb.transaction.api.coordination.CoordinationFeature"
* @fractal.itf name="synchronization" role="client"
signature="org.objectweb.gotm.lib.resource.Resource"
* @fractal.itf name="xa-resource" role="client"
signature="org.objectweb.gotm.lib.resource.Resource"
- * @fractal.itf name="tx-status" role="client"
signature="org.objectweb.transaction.api.transaction.TransactionStatusFeature"
- * @fractal.itf name="tx-activation" role="client"
signature="org.objectweb.transaction.api.transaction.TransactionActivationFeature"
- * @fractal.itf name="tx-interruption" role="client"
signature="org.objectweb.transaction.api.transaction.TransactionInterruptionFeature"
* @fractal.itf name="tx-state" role="client"
signature="org.objectweb.transaction.api.transaction.TransactionState"
* @fractal.itf name="status-converter" role="client"
signature="org.objectweb.gotm.lib.event.EventConverter"
*/
@@ -83,7 +80,6 @@
*/
public String[] clientFc() {
return new String[] {
- TransactionStatusFeature.TX_STATUS,
TransactionActivationFeature.TX_ACTIVATION,
COMMIT,ROLLBACK,
TransactionInterruptionFeature.TRANSACTION_INTERRUPTION,
@@ -94,112 +90,47 @@
};
}
- /**
- * @return Returns the txStatus.
- */
- protected TransactionStatusFeature getTxStatus() {
- try {
- return (TransactionStatusFeature)
lookupFc(TransactionStatusFeature.TX_STATUS);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
- }
-
- /**
- * @return Returns the txActivation.
- */
- protected TransactionActivationFeature getTxActivation() {
- try {
- return (TransactionActivationFeature)
lookupFc(TransactionActivationFeature.TX_ACTIVATION);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
- }
/**
* @return the commit coordination process.
*/
protected CoordinationFeature getTxCommit() {
- try {
- return (CoordinationFeature) lookupFc(COMMIT);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
+ return (CoordinationFeature) fcBindings.get(COMMIT);
}
/**
* @return the rollback coordination process.
*/
protected CoordinationFeature getTxRollback() {
- try {
- return (CoordinationFeature) lookupFc(ROLLBACK);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
- }
-
- /**
- * @return Returns the txInterruption.
- */
- protected TransactionInterruptionFeature getTxInterruption() {
- try {
- return (TransactionInterruptionFeature)
lookupFc(TransactionInterruptionFeature.TRANSACTION_INTERRUPTION);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
+ return (CoordinationFeature) fcBindings.get(ROLLBACK);
}
/**
* @return Returns the txState.
*/
protected TransactionState getTxState() {
- try {
- return (TransactionState)
lookupFc(TransactionState.TRANSACTION_STATE);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
+ return (TransactionState)
fcBindings.get(TransactionState.TRANSACTION_STATE);
}
/**
* @return Returns the syncEnlist.
*/
protected Resource getSynchronization() {
- try {
- return (Resource) lookupFc(SYNCHRONIZATION);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
+ return (Resource) fcBindings.get(SYNCHRONIZATION);
}
/**
* @return Returns the resEnlist.
*/
protected Resource getResource() {
- try {
- return (Resource) lookupFc(RESOURCE);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
+ return (Resource) fcBindings.get(RESOURCE);
}
/**
* @return Returns the event converter.
*/
protected EventConverter getStatusConverter() {
- try {
- return (EventConverter) lookupFc(STATUS_CONVERTER);
- } catch (NoSuchInterfaceException e) {
- getTrace().error(e.getMessage());
- return null;
- }
+ return (EventConverter) fcBindings.get(STATUS_CONVERTER);
}
/* (non-Javadoc)
@@ -218,7 +149,6 @@
throws IllegalStateException
{
getResource().delResource(arg0);
- // TODO Implement resource unregistration.
return true;
}
@@ -236,7 +166,7 @@
* @see javax.transaction.Transaction#getStatus()
*/
public int getStatus() {
- return getStatusConverter().toValue(getTxStatus().getStatus()) ;
+ return getStatusConverter().toValue(getTxState().getStatus()) ;
}
/* (non-Javadoc)
@@ -270,7 +200,7 @@
* @see javax.transaction.UserTransaction#begin()
*/
public void begin() {
- getTxActivation().begin();
+ getTxState().setStatus(TransactionStatusTransactionActive.status);
}
/* (non-Javadoc)
Index: gotm-jts/src/java/org/objectweb/gotm/lib/jta/XAResourceImpl.java
diff -u gotm-jts/src/java/org/objectweb/gotm/lib/jta/XAResourceImpl.java:1.4
gotm-jts/src/java/org/objectweb/gotm/lib/jta/XAResourceImpl.java:1.5
--- gotm-jts/src/java/org/objectweb/gotm/lib/jta/XAResourceImpl.java:1.4
Wed Feb 23 18:39:45 2005
+++ gotm-jts/src/java/org/objectweb/gotm/lib/jta/XAResourceImpl.java Mon
May 23 13:21:01 2005
@@ -22,26 +22,39 @@
Contributor(s): ______________________________________.
---------------------------------------------------------------------
-$Id: XAResourceImpl.java,v 1.4 2005/02/23 17:39:45 rouvoy Exp $
+$Id: XAResourceImpl.java,v 1.5 2005/05/23 11:21:01 rouvoy Exp $
====================================================================*/
-
package org.objectweb.gotm.lib.jta;
+import java.util.Hashtable;
+import java.util.List;
import java.util.Map;
+import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
-import org.objectweb.fractal.api.NoSuchInterfaceException;
+import org.objectweb.gotm.lib.resource.Action;
import org.objectweb.gotm.lib.resource.ResourceImpl;
+import org.objectweb.transaction.api.resource.ResourceVote;
import org.objectweb.transaction.api.transaction.TransactionStatus;
import org.objectweb.transaction.api.xid.XidState;
+import org.objectweb.transaction.lib.resource.ResourceEventCommit;
+import org.objectweb.transaction.lib.resource.ResourceEventRollback;
+import org.objectweb.transaction.lib.resource.ResourceEventVote;
+import org.objectweb.transaction.lib.resource.ResourceVoteCommit;
+import org.objectweb.transaction.lib.resource.ResourceVoteReadOnly;
+import org.objectweb.transaction.lib.resource.ResourceVoteRollback;
+import org.objectweb.transaction.lib.transaction.TransactionStatusCommitted;
+import org.objectweb.transaction.lib.transaction.TransactionStatusRolledBack;
+import
org.objectweb.transaction.lib.transaction.TransactionStatusTransactionActive;
/**
* @author <a href="mailto:Romain.Rouvoy@xxxxxxx">Romain Rouvoy</a>
* @created 3 janv. 2005
- * @modified $Date: 2005/02/23 17:39:45 $
- * @version $Revision: 1.4 $
+ * @modified $Date: 2005/05/23 11:21:01 $
+ * @version $Revision: 1.5 $
* @fractal.itf
*/
public class XAResourceImpl
@@ -58,127 +71,94 @@
* @return the associated XA resource.
*/
protected XAResource getXAResource() {
- try {
- return (XAResource) lookupFc(XA_RESOURCE);
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- return null;
- }
+ return (XAResource) fcBindings.get(XA_RESOURCE);
}
/**
* @return the associated XID.
*/
protected XidState getXid() {
- try {
- return (XidState) lookupFc(XID);
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- return null;
- }
+ return (XidState) fcBindings.get(XID);
}
/**
* @return the current status of the transaction.
*/
protected TransactionStatus getStatus() {
- try {
- return (TransactionStatus) lookupFc(XID);
- } catch (NoSuchInterfaceException e) {
- getTrace().debug(e.getMessage());
- return null;
- }
+ return (TransactionStatus) fcBindings.get(XID);
}
/* (non-Javadoc)
- * @see
org.objectweb.gotm.lib.resource.ResourceWithPool#configureAction(java.lang.String,
java.util.Map, java.lang.Object)
+ * @see org.objectweb.gotm.lib.event.SubscribablePrimitive#getEvents()
*/
- protected Runnable configureAction(String topic, Map context, Object
resource) {
- // TODO Auto-generated method stub
- return null;
+ protected int[] getEvents() {
+ return new int[0];
}
-
+
/* (non-Javadoc)
- * @see org.objectweb.gotm.lib.event.SubscribablePrimitive#getEvents()
+ * @see org.objectweb.gotm.lib.resource.ResourceImpl#declareActions()
*/
- protected String[] getEvents() {
- return new String[0];
+ protected Hashtable declareActions() {
+ Hashtable a = new Hashtable();
+ a.put(TransactionStatusTransactionActive.status.getLabel(),
+ new StartAction());
+ a.put(TransactionStatusRolledBack.status.getValue(),
+ new StopAction(XAResource.TMFAIL));
+ a.put(TransactionStatusCommitted.status.getValue(),
+ new StopAction(XAResource.TMSUCCESS));
+ a.put(ResourceEventVote.event.getValue(),
+ new PrepareAction());
+ a.put(ResourceEventCommit.event.getValue(),
+ new CommitAction());
+ a.put(ResourceEventRollback.event.getValue(),
+ new RollbackAction());
+ return a;
}
-// /* (non-Javadoc)
-// * @see org.objectweb.gotm.lib.jta.ResourceImpl#declare()
-// */
-// protected void declare() {
-// putAction(TransactionStatusTransactionActive.status.getLabel(),
-// new StartAction());
-// putAction(TransactionStatusRolledBack.status.getLabel(),
-// new StopAction(XAResource.TMFAIL));
-// putAction(TransactionStatusCommitted.status.getLabel(),
-// new StopAction(XAResource.TMSUCCESS));
-// putAction(ResourceEventVote.event.getLabel(),
-// new PrepareAction());
-// putAction(ResourceEventCommit.event.getLabel(),
-// new CommitAction());
-// putAction(ResourceEventRollback.event.getLabel(),
-// new RollbackAction());
-// }
-//
-// private class StartAction implements Action {
-// /* (non-Javadoc)
-// * @see
org.objectweb.gotm.lib.jta.XAResourceImpl.Action#apply(org.objectweb.transaction.api.event.EventContext)
-// */
-// public void execute(Set obs, Map ctx) throws Exception {
-// Xid xid = null;
-//
XAResourceImpl.this.getXAResource().start(xid,XAResource.TMNOFLAGS);
-// }
-// }
-// private class StopAction implements Action {
-// private int status ;
-// /**
-// * @param status the status
-// */
-// public StopAction(int status) {this.status = status;}
-// /* (non-Javadoc)
-// * @see
org.objectweb.gotm.lib.jta.XAResourceImpl.Action#apply(java.util.Map)
-// */
-// public void execute(Set obs, Map ctx) throws Exception {
-// XAResourceImpl.this.getXAResource().end(null,this.status);
-// }
-// }
-// private class PrepareAction implements Action {
-// protected void vote(ResourceVote evt, Map ctx) {
-// ((List)ctx.get(evt)).add(XAResourceImpl.this);
-// }
-// /* (non-Javadoc)
-// * @see
org.objectweb.gotm.lib.jta.XAResourceImpl.Action#apply(java.util.Map)
-// */
-// public void execute(Set obs, Map ctx) throws Exception {
-// try {
-// int vote =
XAResourceImpl.this.getXAResource().prepare(null);
-// if (vote == XAResource.XA_OK)
-// vote(ResourceVoteCommit.vote,ctx);
-// else
-// vote(ResourceVoteReadOnly.vote, ctx);
-// } catch (XAException e) {
-// vote(ResourceVoteRollback.vote, ctx);
-// throw e;
-// }
-// }
-// }
-// private class CommitAction implements Action {
-// /* (non-Javadoc)
-// * @see
org.objectweb.gotm.lib.jta.XAResourceImpl.Action#apply(java.util.Map)
-// */
-// public void execute(Set obs, Map ctx) throws Exception{
-// XAResourceImpl.this.getXAResource().commit(null,true);
-// }
-// }
-// private class RollbackAction implements Action {
-// /* (non-Javadoc)
-// * @see
org.objectweb.gotm.lib.jta.XAResourceImpl.Action#apply(java.util.Map)
-// */
-// public void execute(Set obs, Map ctx) throws Exception {
-// XAResourceImpl.this.getXAResource().rollback(null);
-// }
-// }
+ private final class StartAction implements Action {
+ public void execute(Map context, Object resource) throws Exception {
+ Xid xid = null;
+
XAResourceImpl.this.getXAResource().start(xid,XAResource.TMNOFLAGS);
+ }
+ }
+ private static final class StopAction implements Action {
+ private int status ;
+ /**
+ * @param status
+ */
+ public StopAction(int status) {this.status = status;}
+ /* (non-Javadoc)
+ * @see
org.objectweb.gotm.lib.resource.Action#execute(java.util.Map,
java.lang.Object)
+ */
+ public void execute(Map context, Object resource) throws Exception {
+ ((XAResource)resource).end(null,this.status);
+ }
+ }
+ private final class PrepareAction implements Action {
+ protected void vote(ResourceVote evt, Map ctx) {
+ ((List)ctx.get(evt)).add(XAResourceImpl.this);
+ }
+ public void execute(Map context, Object resource) throws Exception {
+ try {
+ int vote = XAResourceImpl.this.getXAResource().prepare(null);
+ if (vote == XAResource.XA_OK)
+ vote(ResourceVoteCommit.vote, context);
+ else
+ vote(ResourceVoteReadOnly.vote, context);
+ } catch (XAException e) {
+ vote(ResourceVoteRollback.vote, context);
+ throw e;
+ }
+ }
+ }
+ private final class CommitAction implements Action {
+ public void execute(Map context, Object resource) throws Exception {
+ XAResourceImpl.this.getXAResource().commit(null,true);
+ }
+ }
+ private final class RollbackAction implements Action {
+ public void execute(Map context, Object resource) throws Exception {
+ XAResourceImpl.this.getXAResource().rollback(null);
+ }
+ }
}
| <-- Date Index | <-- Thread Index |
Powered by MHonArc.
Copyright © 2006-2007, OW2 Consortium | contact | webmaster.