org.ow2.jonas.ee.jdbc
Class XAResourceImpl

java.lang.Object
  extended by org.ow2.jonas.ee.jdbc.XAResourceImpl
All Implemented Interfaces:
XAResource

public class XAResourceImpl
extends Object
implements 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
           
protected  org.objectweb.util.monolog.api.Logger xalog
           
 
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, XAResource xares)
          XAResourceImpl constructor
 
Method Summary
 void commit(Xid xid, boolean onePhase)
          Commit the global transaction specified by xid.
 void end(Xid xid, int flags)
          Ends the transaction
 void forget(Xid xid)
          Need to forget the heuristically completed Xid
 int getTransactionTimeout()
          Get the current transaction timeout for this XAResource
 boolean isSameRM(XAResource xaRes)
          Determine if the resource manager instance is the same as the resouce manager being passed in
 int prepare(Xid xid)
          Prepare the Xid for a transaction commit
 Xid[] recover(int flag)
          Obtain a list of prepared transaction branches from a resource manager.
 void rollback(Xid xid)
          Roll back work done on the Xid
 boolean setTransactionTimeout(int seconds)
          Set the current transaction timeout value for this XAResource
 void start(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

xalog

protected org.objectweb.util.monolog.api.Logger xalog
Constructor Detail

XAResourceImpl

public XAResourceImpl(ManagedConnectionImpl mc,
                      XAResource xares)
XAResourceImpl constructor

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

commit

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

Specified by:
commit in interface XAResource
Throws:
XAException

end

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

Specified by:
end in interface XAResource
Parameters:
xid - transaction xid
flags - One of TMSUCCESS, TMFAIL, or TMSUSPEND.
Throws:
XAException

forget

public void forget(Xid xid)
            throws XAException
Need to forget the heuristically completed Xid

Specified by:
forget in interface XAResource
Throws:
XAException

getTransactionTimeout

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

Specified by:
getTransactionTimeout in interface XAResource
Throws:
XAException

isSameRM

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

Specified by:
isSameRM in interface XAResource
Throws:
XAException

prepare

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

Specified by:
prepare in interface XAResource
Throws:
XAException

recover

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

Specified by:
recover in interface XAResource
Throws:
XAException

rollback

public void rollback(Xid xid)
              throws XAException
Roll back work done on the Xid

Specified by:
rollback in interface XAResource
Throws:
XAException

setTransactionTimeout

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

Specified by:
setTransactionTimeout in interface XAResource
Throws:
XAException

start

public void start(Xid xid,
                  int flags)
           throws 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 XAResource
Throws:
XAException


Copyright © 2010 OW2 Consortium. All Rights Reserved.