Class JBossContextXATerminator
- java.lang.Object
-
- org.jboss.as.txn.integration.JBossContextXATerminator
-
- All Implemented Interfaces:
jakarta.resource.spi.XATerminator,org.jboss.tm.JBossXATerminator
public class JBossContextXATerminator extends Object implements org.jboss.tm.JBossXATerminator
-
-
Constructor Summary
Constructors Constructor Description JBossContextXATerminator(org.wildfly.transaction.client.LocalTransactionContext transactionContext, org.jboss.tm.JBossXATerminator jbossXATerminator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelWork(jakarta.resource.spi.work.Work work, Xid xid)CallingJBossXATerminatorto cancel the work for us.voidcommit(Xid xid, boolean onePhase)voidendWork(jakarta.resource.spi.work.Work work, Xid xid)Suspending transaction and canceling the work.voidforget(Xid xid)intprepare(Xid xid)Xid[]recover(int flag)voidregisterWork(jakarta.resource.spi.work.Work work, Xid xid, long timeout)Interception of register work call to get transaction being imported to wildfly transacton client.voidrollback(Xid xid)voidstartWork(jakarta.resource.spi.work.Work work, Xid xid)Start work gets imported transaction and assign it to current thread.
-
-
-
Method Detail
-
commit
public void commit(Xid xid, boolean onePhase) throws XAException
- Specified by:
commitin interfacejakarta.resource.spi.XATerminator- Throws:
XAException
-
forget
public void forget(Xid xid) throws XAException
- Specified by:
forgetin interfacejakarta.resource.spi.XATerminator- Throws:
XAException
-
prepare
public int prepare(Xid xid) throws XAException
- Specified by:
preparein interfacejakarta.resource.spi.XATerminator- Throws:
XAException
-
recover
public Xid[] recover(int flag) throws XAException
- Specified by:
recoverin interfacejakarta.resource.spi.XATerminator- Throws:
XAException
-
rollback
public void rollback(Xid xid) throws XAException
- Specified by:
rollbackin interfacejakarta.resource.spi.XATerminator- Throws:
XAException
-
registerWork
public void registerWork(jakarta.resource.spi.work.Work work, Xid xid, long timeout) throws jakarta.resource.spi.work.WorkCompletedExceptionInterception of register work call to get transaction being imported to wildfly transacton client.
For importing a transaction Wildfly transaction client eventually calls
SubordinationManageras NarayanaXATerminators do. This wrapping then let wildfly transacton client to register the transaction for itself, wildfly transacton client then import transaction to Narayana too and finally this method uses Narayana'sXATerminatorto register allWorks binding.
Narayana'sXATerminatortries to import transaction too but as transaction is already imported it just gets instance of transaction already imported via call of wildfly transacton client.- Specified by:
registerWorkin interfaceorg.jboss.tm.JBossXATerminator- Throws:
jakarta.resource.spi.work.WorkCompletedException
-
startWork
public void startWork(jakarta.resource.spi.work.Work work, Xid xid) throws jakarta.resource.spi.work.WorkCompletedExceptionStart work gets imported transaction and assign it to current thread.
This method mimics behavior of Narayana's
JBossXATerminator.- Specified by:
startWorkin interfaceorg.jboss.tm.JBossXATerminator- Throws:
jakarta.resource.spi.work.WorkCompletedException
-
endWork
public void endWork(jakarta.resource.spi.work.Work work, Xid xid)Suspending transaction and canceling the work.
Suspend transaction has to be called on the wildfly transaction manager and the we delegate work cancellation to
JBossXATerminator.
First we have to cancel the work for jboss terminator would not work with suspended transaction.- Specified by:
endWorkin interfaceorg.jboss.tm.JBossXATerminator
-
cancelWork
public void cancelWork(jakarta.resource.spi.work.Work work, Xid xid)Calling
JBossXATerminatorto cancel the work for us.There should not be need any action to be processed by wildfly transaction client.
- Specified by:
cancelWorkin interfaceorg.jboss.tm.JBossXATerminator
-
-