[jboss-user] [JCA/JBoss] - Re: Stateless EJB calling WorkManager directly - legal?
vickyk
do-not-reply at jboss.com
Thu Mar 13 10:06:49 EDT 2008
"gsniderJBoss" wrote : How can I coordinate these transactions? Do I need an RA?
Ok after looking at this post again and Adrian's response I think you should set the Xid on the ExecutionContext , this will not create new transaction TX2. Oh you have done this and I did not read this , my bad :(
Here is the code from older TM which basically imports the Transaction from XId supplied to ExecutionContext
public void registerWork(Work work, Xid xid, long timeout) throws WorkCompletedException
| {
| if (trace)
| log.trace("registering work=" + work + " xid=" + xid + " timeout=" + timeout);
| try
| {
| TransactionImpl tx = importExternalTransaction(xid, timeout);
| tx.setWork(work);
| }
| catch (WorkCompletedException e)
| {
| throw e;
| }
| catch (Throwable t)
| {
| WorkCompletedException e = new WorkCompletedException("Error registering work", t);
| e.setErrorCode(WorkException.TX_RECREATE_FAILED);
| throw e;
| }
| if (trace)
| log.trace("registered work= " + work + " xid=" + xid + " timeout=" + timeout);
| }
http://anonsvn.jboss.org/repos/jbossas/branches/Branch_4_2/transaction/src/main/org/jboss/tm/TxManager.java
And this should also be handled in new TM(JbossTS) .
I need to see how to get the Xid , this is what will not be portable across the AS's .
"gsniderJBoss" wrote : But I cannot for the life of me get the Xid of the first transaction (TX1 above).
I think you should do this
1) Get the TransactionManger from jndi .
2) Call getTransaction() on [1]
3) This Transaction obtained from [2] should be able to give you the Xid , I can see the older TM having getXid() method.
http://anonsvn.jboss.org/repos/jbossas/branches/Branch_4_2/transaction/src/main/org/jboss/tm/TransactionImpl.java
I need to find out how this can be done with Arjuna as 4.2.2 will have it , I will look at it . If you want to know about this quicker go to the Transaction forums Or dig code yourself if you are not lazy :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4136292#4136292
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4136292
More information about the jboss-user
mailing list