Package com.sun.gjc.spi
Class XAResourceImpl
- java.lang.Object
-
- com.sun.gjc.spi.XAResourceImpl
-
- All Implemented Interfaces:
XAResource
public class XAResourceImpl extends Object implements XAResource
XAResourcewrapper for Generic JDBC Connector.- Version:
- 1.0, 02/08/23
- Author:
- Evani Sai Surya Kiran
-
-
Field Summary
-
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
-
-
Constructor Summary
Constructors Constructor Description XAResourceImpl(XAResource xar, ManagedConnectionImpl mc)Constructor for XAResourceImpl
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcommit(Xid xid, boolean onePhase)Commit the global transaction specified by xid.voidend(Xid xid, int flags)Ends the work performed on behalf of a transaction branch.voidforget(Xid xid)Tell the resource manager to forget about a heuristically completed transaction branch.intgetTransactionTimeout()Obtain the current transaction timeout value set for thisXAResourceinstance.booleanisSameRM(XAResource xares)This method is called to determine if the resource manager instance represented by the target object is the same as the resouce manager instance represented by the parameter xares.intprepare(Xid xid)Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.Xid[]recover(int flag)Obtain a list of prepared transaction branches from a resource manager.voidrollback(Xid xid)Inform the resource manager to roll back work done on behalf of a transaction branchbooleansetTransactionTimeout(int seconds)Set the current transaction timeout value for thisXAResourceinstance.voidstart(Xid xid, int flags)Start work on behalf of a transaction branch specified in xid.
-
-
-
Constructor Detail
-
XAResourceImpl
public XAResourceImpl(XAResource xar, ManagedConnectionImpl mc)
Constructor for XAResourceImpl- Parameters:
xar-XAResourcemc-ManagedConnection
-
-
Method Detail
-
commit
public void commit(Xid xid, boolean onePhase) throws XAException
Commit the global transaction specified by xid.- Specified by:
commitin interfaceXAResource- Parameters:
xid- A global transaction identifieronePhase- If true, the resource manager should use a one-phase commit protocol to commit the work done on behalf of xid.- Throws:
XAException
-
end
public void end(Xid xid, int flags) throws XAException
Ends the work performed on behalf of a transaction branch.- Specified by:
endin interfaceXAResource- Parameters:
xid- A global transaction identifier that is the same as what was used previously in the start method.flags- One of TMSUCCESS, TMFAIL, or TMSUSPEND- Throws:
XAException
-
forget
public void forget(Xid xid) throws XAException
Tell the resource manager to forget about a heuristically completed transaction branch.- Specified by:
forgetin interfaceXAResource- Parameters:
xid- A global transaction identifier- Throws:
XAException
-
getTransactionTimeout
public int getTransactionTimeout() throws XAExceptionObtain the current transaction timeout value set for thisXAResourceinstance.- Specified by:
getTransactionTimeoutin interfaceXAResource- Returns:
- the transaction timeout value in seconds
- Throws:
XAException
-
isSameRM
public boolean isSameRM(XAResource xares) throws XAException
This method is called to determine if the resource manager instance represented by the target object is the same as the resouce manager instance represented by the parameter xares.- Specified by:
isSameRMin interfaceXAResource- Parameters:
xares- AnXAResourceobject whose resource manager instance is to be compared with the resource- Returns:
- true if it's the same RM instance; otherwise false.
- Throws:
XAException
-
prepare
public int prepare(Xid xid) throws XAException
Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.- Specified by:
preparein interfaceXAResource- Parameters:
xid- A global transaction identifier- Returns:
- A value indicating the resource manager's vote on the
outcome of the transaction. The possible values
are: XA_RDONLY or XA_OK. If the resource manager wants
to roll back the transaction, it should do so
by raising an appropriate
XAExceptionin the prepare method. - Throws:
XAException
-
recover
public Xid[] recover(int flag) throws XAException
Obtain a list of prepared transaction branches from a resource manager.- Specified by:
recoverin interfaceXAResource- Parameters:
flag- One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must be used when no other flags are set in flags.- Returns:
- The resource manager returns zero or more XIDs for the transaction
branches that are currently in a prepared or heuristically
completed state. If an error occurs during the operation, the resource
manager should throw the appropriate
XAException. - Throws:
XAException
-
rollback
public void rollback(Xid xid) throws XAException
Inform the resource manager to roll back work done on behalf of a transaction branch- Specified by:
rollbackin interfaceXAResource- Parameters:
xid- A global transaction identifier- Throws:
XAException
-
setTransactionTimeout
public boolean setTransactionTimeout(int seconds) throws XAExceptionSet the current transaction timeout value for thisXAResourceinstance.- Specified by:
setTransactionTimeoutin interfaceXAResource- Parameters:
seconds- the transaction timeout value in seconds.- Returns:
- true if transaction timeout value is set successfully; otherwise false.
- Throws:
XAException
-
start
public void start(Xid xid, int flags) throws XAException
Start work on behalf of a transaction branch specified in xid.- Specified by:
startin interfaceXAResource- Parameters:
xid- A global transaction identifier to be associated with the resourceflags- One ofXAResource.TMNOFLAGS,XAResource.TMJOIN, orXAResource.TMRESUME- Throws:
XAException
-
-