JBoss Community

Can the JBoss JCA support multiple XAResources?

created by ShuiXin Zhang in IronJacamar - View the full discussion

Hi all,

I have a connector based on JCA. I am confused on the inflow transaction issue.

I construct a XID and submit the work to work manager. The work will access the same database twice, and they will use 2 XAResources. I configured that all XAResource are not belong to same RM.

The first XAResource can work fine, but the second XAResource will use the same XID to start, it is failed.

 

I noticed that the TransactionImple will use com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.jca.TransactionImple, its createXid method will use the below code, it will use the old one.

 

I want to confirm that JCA subordinator can only include one XAResource? If it is no, how can I do it?

 

 

    private final Xid createXid(boolean branch, XAModifier theModifier)
    {
        Xid xid = baseXid();
  
        if (xid != null)
            return xid;
  
        xid = new XidImple(_theTransaction, branch);
  
        if (theModifier != null)
        {
            try
            {
                xid = theModifier.createXid((XidImple) xid);
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
  
        return xid;
    }

 

 

public final Xid baseXid ()
{
    return ((SubordinateAtomicAction) _theTransaction).getXid();
}

 

It's my start transaction code snippet.

 

ResourceAdapterImpl ra = (ResourceAdapterImpl)notifier_.getResourceAdapter();
BootstrapContext ctx = ra.getContext();
Xid xid = getXid(tid);
WorkManager workMgr = ctx.getWorkManager();
ExecutionContext ectx = new ExecutionContext();
ectx.setXid(xid);
MyWork work = new MyWork(this, events);
workMgr.doWork(work, WorkManager.INDEFINITE, ectx, work);

 

I use JBossTS 4.2.3 SP5 C09.

Reply to this message by going to Community

Start a new discussion in IronJacamar at Community