[jboss-svn-commits] JBL Code SVN: r37612 - labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Oct 19 13:42:29 EDT 2011
Author: tomjenkinson
Date: 2011-10-19 13:42:29 -0400 (Wed, 19 Oct 2011)
New Revision: 37612
Modified:
labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/ExampleDistributedJTATestCase.java
labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/TestResource.java
Log:
JBTM-895 removed the read only part of the testresource to aid readability
Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/ExampleDistributedJTATestCase.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/ExampleDistributedJTATestCase.java 2011-10-19 17:14:28 UTC (rev 37611)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/ExampleDistributedJTATestCase.java 2011-10-19 17:42:29 UTC (rev 37612)
@@ -125,7 +125,7 @@
Transaction originalTransaction = transactionManager.getTransaction();
originalTransaction.registerSynchronization(new TestSynchronization(originalServer.getNodeName()));
- originalTransaction.enlistResource(new TestResource(counter, originalServer.getNodeName(), false));
+ originalTransaction.enlistResource(new TestResource(counter, originalServer.getNodeName()));
if (!nodesToFlowTo.isEmpty()) {
Integer nextServerNodeName = nodesToFlowTo.get(0);
@@ -172,7 +172,7 @@
TransactionManager transactionManager = currentServer.getTransactionManager();
Transaction transaction = transactionManager.getTransaction();
transaction.registerSynchronization(new TestSynchronization(currentServer.getNodeName()));
- transaction.enlistResource(new TestResource(counter, currentServer.getNodeName(), false));
+ transaction.enlistResource(new TestResource(counter, currentServer.getNodeName()));
if (!nodesToFlowTo.isEmpty()) {
Integer nextServerNodeName = nodesToFlowTo.get(0);
Modified: labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/TestResource.java
===================================================================
--- labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/TestResource.java 2011-10-19 17:14:28 UTC (rev 37611)
+++ labs/jbosstm/branches/JBOSSTS_4_15_0_Final/atsintegration/examples/classes/com/arjuna/jta/distributed/example/TestResource.java 2011-10-19 17:42:29 UTC (rev 37612)
@@ -41,18 +41,15 @@
protected int timeout = 0;
- private boolean readonly = false;
-
private File file;
private int serverId;
private CompletionCounter completionCounter;
- public TestResource(CompletionCounter completionCounter, int serverId, boolean readonly) {
+ public TestResource(CompletionCounter completionCounter, int serverId) {
this.completionCounter = completionCounter;
this.serverId = serverId;
- this.readonly = readonly;
}
public TestResource(CompletionCounter completionCounter, int serverId, File file) throws IOException {
@@ -89,32 +86,28 @@
public synchronized int prepare(Xid xid) throws XAException {
System.out.println(" TestResource (" + serverId + ") XA_PREPARE [" + xid + "]");
- if (readonly)
- return XA_RDONLY;
- else {
- File dir = new File(System.getProperty("user.dir") + "/distributedjta-example/TestResource/" + serverId + "/");
- dir.mkdirs();
- file = new File(dir, new Uid().fileStringForm() + "_");
- try {
- file.createNewFile();
- final int formatId = xid.getFormatId();
- final byte[] gtrid = xid.getGlobalTransactionId();
- final int gtrid_length = gtrid.length;
- final byte[] bqual = xid.getBranchQualifier();
- final int bqual_length = bqual.length;
+ File dir = new File(System.getProperty("user.dir") + "/distributedjta-example/TestResource/" + serverId + "/");
+ dir.mkdirs();
+ file = new File(dir, new Uid().fileStringForm() + "_");
+ try {
+ file.createNewFile();
+ final int formatId = xid.getFormatId();
+ final byte[] gtrid = xid.getGlobalTransactionId();
+ final int gtrid_length = gtrid.length;
+ final byte[] bqual = xid.getBranchQualifier();
+ final int bqual_length = bqual.length;
- DataOutputStream fos = new DataOutputStream(new FileOutputStream(file));
- fos.writeInt(formatId);
- fos.writeInt(gtrid_length);
- fos.write(gtrid, 0, gtrid_length);
- fos.writeInt(bqual_length);
- fos.write(bqual, 0, bqual_length);
- } catch (IOException e) {
- e.printStackTrace();
- throw new XAException(XAException.XAER_RMERR);
- }
- return XA_OK;
+ DataOutputStream fos = new DataOutputStream(new FileOutputStream(file));
+ fos.writeInt(formatId);
+ fos.writeInt(gtrid_length);
+ fos.write(gtrid, 0, gtrid_length);
+ fos.writeInt(bqual_length);
+ fos.write(bqual, 0, bqual_length);
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new XAException(XAException.XAER_RMERR);
}
+ return XA_OK;
// throw new XAException();
}
More information about the jboss-svn-commits
mailing list