[jboss-svn-commits] JBL Code SVN: r37792 - in labs/jbosstm/trunk: ArjunaJTA and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Dec 12 07:40:46 EST 2011
Author: jhalliday
Date: 2011-12-12 07:40:46 -0500 (Mon, 12 Dec 2011)
New Revision: 37792
Modified:
labs/jbosstm/trunk/
labs/jbosstm/trunk/ArjunaJTA/
labs/jbosstm/trunk/ArjunaJTA/jta/tests/classes/com/hp/mwtests/ts/jta/subordinate/SubordinateTestCase.java
labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/ServerControl.java
Log:
Fix NPE in Subordinate JTS tx. JBTM-957
Property changes on: labs/jbosstm/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /labs/jbosstm/branches/JBOSSTS_4_15_0_Final:37308,37480,37484,37492,37529,37728
+ /labs/jbosstm/branches/JBOSSTS_4_15_0_Final:37308,37480,37484,37492,37529,37728
/labs/jbosstm/branches/JBOSSTS_4_16:37782
Property changes on: labs/jbosstm/trunk/ArjunaJTA
___________________________________________________________________
Modified: svn:mergeinfo
- /labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA:37308,37480,37484,37492,37529,37537,37728
+ /labs/jbosstm/branches/JBOSSTS_4_15_0_Final/ArjunaJTA:37308,37480,37484,37492,37529,37537,37728
/labs/jbosstm/branches/JBOSSTS_4_16/ArjunaJTA:37782
Modified: labs/jbosstm/trunk/ArjunaJTA/jta/tests/classes/com/hp/mwtests/ts/jta/subordinate/SubordinateTestCase.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTA/jta/tests/classes/com/hp/mwtests/ts/jta/subordinate/SubordinateTestCase.java 2011-12-12 11:30:31 UTC (rev 37791)
+++ labs/jbosstm/trunk/ArjunaJTA/jta/tests/classes/com/hp/mwtests/ts/jta/subordinate/SubordinateTestCase.java 2011-12-12 12:40:46 UTC (rev 37792)
@@ -54,8 +54,8 @@
{
final SubordinateTransaction tm = createTransaction();
- tm.doPrepare();
- tm.doCommit();
+ assertEquals(TwoPhaseOutcome.PREPARE_READONLY, tm.doPrepare());
+ // don't call commit for read only case.
}
assertEquals(ActionManager.manager().getNumberOfInflightTransactions(), 0);
@@ -81,8 +81,8 @@
{
final SubordinateTransaction tm = createTransaction();
- tm.doPrepare();
- tm.doRollback();
+ assertEquals(TwoPhaseOutcome.PREPARE_READONLY, tm.doPrepare());
+ // don't call rollback for read only case
}
assertEquals(ActionManager.manager().getNumberOfInflightTransactions(), 0);
@@ -203,7 +203,7 @@
final TestSynchronization sync = new TestSynchronization();
tm.registerSynchronization(sync);
assertEquals(TwoPhaseOutcome.PREPARE_READONLY, tm.doPrepare());
- tm.doCommit();
+ // don't call commit for read only case
assertTrue(sync.isBeforeCompletionDone());
assertTrue(sync.isAfterCompletionDone());
assertEquals(javax.transaction.Status.STATUS_COMMITTED, tm.getStatus());
@@ -218,7 +218,7 @@
t.registerSynchronization(sync);
final XATerminator xaTerminator = SubordinationManager.getXATerminator();
assertEquals(XAResource.XA_RDONLY, xaTerminator.prepare(xid));
- // note that unlike the above test we don't call commit - the XA_RDONLY means its finished, per XA semantics.
+ // don't call commit for read only case
assertTrue(sync.isBeforeCompletionDone());
assertTrue(sync.isAfterCompletionDone());
assertEquals(javax.transaction.Status.STATUS_COMMITTED, t.getStatus());
@@ -406,7 +406,7 @@
tm.registerSynchronization(sync);
tm.doBeforeCompletion();
assertEquals(TwoPhaseOutcome.PREPARE_READONLY, tm.doPrepare());
- tm.doCommit();
+ // don't call commit for read only case
assertTrue(sync.isBeforeCompletionDone());
assertTrue(sync.isAfterCompletionDone());
assertEquals(javax.transaction.Status.STATUS_COMMITTED, tm.getStatus());
@@ -423,7 +423,7 @@
final XATerminatorExtensions xaTerminatorExtensions = (XATerminatorExtensions)xaTerminator;
xaTerminatorExtensions.beforeCompletion(xid);
assertEquals(XAResource.XA_RDONLY, xaTerminator.prepare(xid));
- // note that unlike the above test we don't call commit - the XA_RDONLY means its finished, per XA semantics.
+ // don't call commit for read only case
assertTrue(sync.isBeforeCompletionDone());
assertTrue(sync.isAfterCompletionDone());
assertEquals(javax.transaction.Status.STATUS_COMMITTED, t.getStatus());
@@ -528,13 +528,13 @@
catch (final XAException ex)
{
// success!
-
+
return;
}
assertTrue("commit should throw an exception and not get to here", false);
}
-
+
@Test
public void testFailOnCommitRetry () throws Exception
{
@@ -550,17 +550,17 @@
final XATerminator xaTerminator = SubordinationManager.getXATerminator();
xaTerminator.prepare(xid);
-
+
/*
* This should not cause problems. The transaction really has committed, or will once
* recovery kicks off. So nothing for the parent to do. The subordinate log will
* maintain enough information to drive recovery locally if we get to the point of
* issuing a commit call from parent to child.
*/
-
+
xaTerminator.commit(xid, false);
}
-
+
@Test
public void testFailOnCommit() throws Exception
{
@@ -585,10 +585,10 @@
catch (final XAException ex)
{
// success!!
-
+
return;
}
-
+
assertTrue("commit should throw an exception and not get to here", false);
}
}
Modified: labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/ServerControl.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/ServerControl.java 2011-12-12 11:30:31 UTC (rev 37791)
+++ labs/jbosstm/trunk/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/orbspecific/interposition/ServerControl.java 2011-12-12 12:40:46 UTC (rev 37792)
@@ -1,8 +1,8 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags.
- * See the copyright.txt in the distribution for a full listing
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
* of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
@@ -14,7 +14,7 @@
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
- *
+ *
* (C) 2005-2006,
* @author JBoss Inc.
*/
@@ -24,7 +24,7 @@
* Hewlett-Packard Arjuna Labs,
* Newcastle upon Tyne,
* Tyne and Wear,
- * UK.
+ * UK.
*
* $Id: ServerControl.java 2342 2006-03-30 13:06:17Z $
*/
@@ -52,12 +52,12 @@
/**
* As with ControlImple, the transaction is maintained until the control object
* is deleted.
- *
+ *
* This class maintains a handle on the current server-side transaction, and
* also references to the original transaction it is "mirroring". This allows us
* to have a single place to hold both sets of information which is accessible
* to interposed resources, synchronizations, and transactions.
- *
+ *
* @author Mark Little (mark at arjuna.com)
* @version $Id: ServerControl.java 2342 2006-03-30 13:06:17Z $
* @since JTS 1.0.
@@ -90,14 +90,14 @@
* that is the case, then why create a new transaction to manage it -
* this will only add to the disk access? However, currently we cannot
* do this optimisation because:
- *
+ *
* (i) if the original control is being terminated from a remote
* process, it will not be able to force thread-to-transaction
* association (ArjunaTransactionImple et al don't do that.)
- *
+ *
* (ii) certain AIT records require thread-to-transaction association in
* order to work (e.g., LockRecord).
- *
+ *
* What this means is that if we do this optimisation and an application
* uses AIT, all AIT records will be added to the parent (original)
* transaction and not the interposed transaction (which does do
@@ -217,6 +217,8 @@
_transactionHandle = stx;
_theUid = stx.get_uid();
+ _transactionHandle.setControlHandle(this); // JBTM-957
+
createTransactionHandle();
addControl();
More information about the jboss-svn-commits
mailing list