-
15. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
clebert.suconic Jun 9, 2010 3:46 PM (in response to ataylor)Why dont i add a thread local for this setting that gets set at the beginning and will outlive the rollback/end. I think its all called within the same thread?
I don't think it would work. The same thread will be reused later.
I was just looking at the code. There's a cleanup method on it. Can't we use it to determine when the Connection was closed? We shouldn't clear the isXA status until the clear is called.
-
16. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
timfox Jun 9, 2010 3:52 PM (in response to ataylor)I assume you're talking about BMT here? Also, is this is an MDB?
(Some illustrative code would be good)
-
17. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
ataylor Jun 9, 2010 3:54 PM (in response to clebert.suconic)Clebert Suconic wrote:
Why dont i add a thread local for this setting that gets set at the beginning and will outlive the rollback/end. I think its all called within the same thread?
I don't think it would work. The same thread will be reused later.
I was just looking at the code. There's a cleanup method on it. Can't we use it to determine when the Connection was closed? We shouldn't clear the isXA status until the clear is called.
if cleanup is called when the connection is returned to the pool i guess we should only reset it to false here and that would fix it.
-
18. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
ataylor Jun 9, 2010 3:54 PM (in response to timfox)Tim Fox wrote:
I assume you're talking about BMT here? Also, is this is an MDB?
(Some illustrative code would be good)
its used by the managed connection, created when u look up JmsXA factory
-
19. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
timfox Jun 9, 2010 3:57 PM (in response to ataylor)Yes, cleanup shouldn't be called if the user still has a handle to the connection.
From the moment the user gets the connection to the moment the user returns it to the pool by calling close(), that connection should either be XA or not, but never change from one to another
-
20. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
clebert.suconic Jun 9, 2010 3:58 PM (in response to timfox)Tim Fox wrote:
I assume you're talking about BMT here? Also, is this is an MDB?
(Some illustrative code would be good)
This is about UserTransaction.. so it has to be BMT.
The first post has the code...
UserTransaction ut = sessionCtx.getUserTransaction();
ut.setTransactionTimeout(5);
ut.begin();mc.receiveNoWait();
mc.close();
try
{
Thread.sleep(10000);
}
catch (InterruptedException ignored)
{
}// nothing here should be accepted since the transaction is expired (more than 5 seconds).
try
{
MessageProducer p = s.createProducer(queue);
Message m = s.createTextMessage("100");
p.send(m);
}
catch (JMSException expected)
{
} -
21. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
timfox Jun 9, 2010 4:04 PM (in response to clebert.suconic)Ok so in the above case the connection hasn't been returned to the pool, so it shouldn't be reset
-
22. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
clebert.suconic Jun 9, 2010 6:25 PM (in response to timfox)TX.end was clearing the state. I have removed that, tested and it works now.
-
23. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
clebert.suconic Jun 12, 2010 10:51 AM (in response to clebert.suconic)I cut a snapshot and integrated it on the application server, then I've run the TCK with this fix... This fix is breaking the TCK
There are quite a few tests that are doing this:
Connection c = .... Open the RA Connection ...
Session s = c.openSession(....)
MessageProducer p = s.openSession(....)
UserTransaction.beingTransa
UserTransaction.rollback();
p.send(...);
And expecting the message to be sent as non-transacted. In other words expecting the Connection to be clean after the rollback.
If we fix the above test, TransactionActiveUnitTestCase won't work any more.
We would need to be able to differentiate a Timeout and a regular rollback. Currently the TM don't make any distinction for us.. as a simple End(sucess) will be called prior to the rollback();
I will check on the legacy RA if they are doing any magic to make the distinction. Otherwise I guess we will need the TM to give us some way to distinguish the timeout ocurring.
My suggestion so far is the TM calling End(Failure) before the rollback.
-
24. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
clebert.suconic Jun 12, 2010 11:04 AM (in response to clebert.suconic)The legacy adapter is solving this by checking the state on the transaction manager directly. I will see if I can implement something without adding new dependencies.
For reference this is the method from the old RA:
public void checkTransactionActive() throws RollbackException, SystemException { if (tm == null) throw new IllegalStateException("No transaction manager: " + ccmName); Transaction tx = tm.getTransaction(); if (tx != null) { int status = tx.getStatus(); // Only allow states that will actually succeed if (status != Status.STATUS_ACTIVE && status != Status.STATUS_PREPARING && status != Status.STATUS_PREPARED && status != Status.STATUS_COMMITTING) { if (status == Status.STATUS_MARKED_ROLLBACK && IGNORE_STATUS_MARKED_FOR_ROLLBACK) ; // allow database access even though transaction is marked to fail else throw new RollbackException("Transaction " + tx + " cannot proceed " + TxUtils.getStatusAsString(status)); } } }
-
25. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
clebert.suconic Jun 12, 2010 11:14 AM (in response to clebert.suconic)Our ResourceAdaptor don't have any reference to the Transaction Manager.
The only place the TM is accessed is through our activation code, where a bunch of reflection is done to setup the timeout of the transaction, if passed through activation.
We would need access to the TM through the ConnectionManager or anything global on the Resource Adapter to fix this issue.
-
26. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
timfox Jun 13, 2010 4:39 AM (in response to clebert.suconic)You can't assume access to the transaction manager, since the RA must work in other app servers too.
-
27. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
clebert.suconic Jun 13, 2010 4:18 PM (in response to timfox)Sure, I know.. it's going to be pluggable and optional.
If the TM is not available on the RA.. all will behave as it would behave now.
-
28. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
clebert.suconic Jun 14, 2010 12:54 AM (in response to clebert.suconic)FYI I've added the plugin to locate the transaction manager on HornetQResourceAdapter and removed it from the Activation. The MessageHandler will be able to get the TransactionManager (if available) from the ResourceAdapter.
-
29. Re: Regression on AS6 org.jboss.test.jca.test.TransactionActiveUnitTestCase
clebert.suconic Jun 14, 2010 12:58 AM (in response to clebert.suconic)BTW: I've checked on my box and both the TCK and the AS testsuite are now passing with trunk. I'm just waiting the result from Hudson to have an official stamp and I will be able to cut a 2.1.1 release after that's confirmed.