org.objectweb.jonas.jdbc
Class XAResourceImpl

java.lang.Object
  extended by org.objectweb.jonas.jdbc.XAResourceImpl
All Implemented Interfaces:
javax.transaction.xa.XAResource

public class XAResourceImpl
extends java.lang.Object
implements javax.transaction.xa.XAResource

This is an implementation of XAResource used for transaction mgmt with a JDBC driver. The standard JDBC drivers don't support real XA, so the prepare will just return OK and work will be done in the commit/rollback.


Field Summary
protected  ManagedConnectionImpl mc
           
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
XAResourceImpl(ManagedConnectionImpl mc, javax.transaction.xa.XAResource xares)
          XAResourceImpl constructor
 
Method Summary
 void commit(javax.transaction.xa.Xid xid, boolean onePhase)
          Commit the global transaction specified by xid.
 void end(javax.transaction.xa.Xid xid, int flags)
          Ends the transaction
 void forget(javax.transaction.xa.Xid xid)
          Need to forget the heuristically completed Xid
 int getTransactionTimeout()
          Get the current transaction timeout for this XAResource
 boolean isSameRM(javax.transaction.xa.XAResource xaRes)
          Determine if the resource manager instance is the same as the resouce manager being passed in
 int prepare(javax.transaction.xa.Xid xid)
          Prepare the Xid for a transaction commit
 javax.transaction.xa.Xid[] recover(int flag)
          Obtain a list of prepared transaction branches from a resource manager.
 void rollback(javax.transaction.xa.Xid xid)
          Roll back work done on the Xid
 boolean setTransactionTimeout(int seconds)
          Set the current transaction timeout value for this XAResource
 void start(javax.transaction.xa.Xid xid, int flags)
          Start work on this Xid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mc

protected ManagedConnectionImpl mc
Constructor Detail

XAResourceImpl

public XAResourceImpl(ManagedConnectionImpl mc,
                      javax.transaction.xa.XAResource xares)
XAResourceImpl constructor

Parameters:
mc - ManagedConnectionImpl used with this object
xares - XAResource from DB if supported
Method Detail

commit

public void commit(javax.transaction.xa.Xid xid,
                   boolean onePhase)
            throws javax.transaction.xa.XAException
Commit the global transaction specified by xid.

Specified by:
commit in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

end

public void end(javax.transaction.xa.Xid xid,
                int flags)
         throws javax.transaction.xa.XAException
Ends the transaction

Specified by:
end in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

forget

public void forget(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Need to forget the heuristically completed Xid

Specified by:
forget in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

getTransactionTimeout

public int getTransactionTimeout()
                          throws javax.transaction.xa.XAException
Get the current transaction timeout for this XAResource

Specified by:
getTransactionTimeout in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

isSameRM

public boolean isSameRM(javax.transaction.xa.XAResource xaRes)
                 throws javax.transaction.xa.XAException
Determine if the resource manager instance is the same as the resouce manager being passed in

Specified by:
isSameRM in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

prepare

public int prepare(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Prepare the Xid for a transaction commit

Specified by:
prepare in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

recover

public javax.transaction.xa.Xid[] recover(int flag)
                                   throws javax.transaction.xa.XAException
Obtain a list of prepared transaction branches from a resource manager.

Specified by:
recover in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

rollback

public void rollback(javax.transaction.xa.Xid xid)
              throws javax.transaction.xa.XAException
Roll back work done on the Xid

Specified by:
rollback in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

setTransactionTimeout

public boolean setTransactionTimeout(int seconds)
                              throws javax.transaction.xa.XAException
Set the current transaction timeout value for this XAResource

Specified by:
setTransactionTimeout in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException

start

public void start(javax.transaction.xa.Xid xid,
                  int flags)
           throws javax.transaction.xa.XAException
Start work on this Xid. If TMJOIN is on, then join an existing transaction already started by the RM.

Specified by:
start in interface javax.transaction.xa.XAResource
Throws:
javax.transaction.xa.XAException