[jboss-user] [JCA/JBoss] - Re: Opening connection from a marked rollback tx
vickyk
do-not-reply at jboss.com
Thu Nov 22 01:25:39 EST 2007
"oglueck" wrote :
| Anyway, yes we are drifting away from the problem. I still think it is perfectly legal to open as many connections as I like even if the current tx is set rollback-only. I guess the rollback-only flag is only set in the transaction manager and the connection is completely unaware of this fact until the transaction manager performs the rollback at the end.
When the getConnection() is called on the ConnectionFactory for the xa-tx-datasource the AS should make sure that the associated XA Resource is enlisted in the associated Transaction .
Now if you have the following sequence
1) Start TX T1
2) CF.getConnection(); The associated XAResource with the connection will get enlisted in the T1.
3) SET ROLLBACK on T1 . This step basically sets
case Status.STATUS_PREPARED:
| status = Status.STATUS_MARKED_ROLLBACK;
Look at
http://anonsvn.jboss.org/repos/jbossas/branches/Branch_4_0/transaction/src/main/org/jboss/tm/TransactionImpl.java
4) Again calling the CF.getConnection() will be able to get the same ManagedConnection from the TransactionLocal but when the associated XAResource is getting enlisted in associated TX this code will get called
| // Inactive transaction
| Transaction threadTx = tm.getTransaction();
| if (threadTx == null || status != Status.STATUS_ACTIVE)
| {
| String error = "Transaction " + threadTx + " is not active " + TxUtils.getStatusAsString(status);
| if (trace)
| log.trace(error + " cl=" + this);
| throw new IllegalStateException(error);
| }
http://anonsvn.jboss.org/repos/jbossas/branches/Branch_4_0/connector/src/main/org/jboss/resource/connectionmanager/TxConnectionManager.java
So Connection would not be taken and you would get IllegalStateException .....
Enable to TRACE logging on the org.jboss.resource(JBoss JCA) and org.jboss.tm(Transaction Manager) and figure out what is going on ....
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4106969#4106969
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4106969
More information about the jboss-user
mailing list