org.jboss.jca.adapters.jdbc.xa
Class XAManagedConnection

java.lang.Object
  extended by org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection
      extended by org.jboss.jca.adapters.jdbc.xa.XAManagedConnection
All Implemented Interfaces:
javax.resource.spi.LocalTransaction, javax.resource.spi.ManagedConnection, XAResource

public class XAManagedConnection
extends BaseWrapperManagedConnection
implements XAResource, javax.resource.spi.LocalTransaction

XAManagedConnection

Version:
$Revision: 76313 $
Author:
David Jencks , Adrian Brock, Weston Price

Field Summary
protected  Xid currentXid
          The Xid
protected  XAConnection xaConnection
          The XA connection
protected  XAResource xaResource
          The XAResource
 
Fields inherited from class org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection
con, destroyed, inLocalTransaction, inManagedTransaction, jdbcAutoCommit, jdbcReadOnly, jdbcTransactionIsolation, mcf, metadata, props, stateLock, underlyingAutoCommit, underlyingReadOnly
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
XAManagedConnection(XAManagedConnectionFactory mcf, XAConnection xaConnection, Properties props, int transactionIsolation, int psCacheSize)
          Constructor
 
Method Summary
 void begin()
          
protected  void broadcastConnectionError(SQLException e)
          
 void commit()
          
 void commit(Xid xid, boolean onePhase)
          
 void destroy()
          Destroy
 void end(Xid xid, int flags)
          
 void forget(Xid xid)
          
 javax.resource.spi.LocalTransaction getLocalTransaction()
          
 int getTransactionTimeout()
          
 XAResource getXAResource()
          
 boolean isSameRM(XAResource other)
          
 boolean isXA()
          Returns true if the underlying connection is handled by an XA resource manager
 int prepare(Xid xid)
          
 Xid[] recover(int flag)
          
 void rollback()
          
 void rollback(Xid xid)
          
 boolean setTransactionTimeout(int seconds)
          
 void start(Xid xid, int flags)
          
 
Methods inherited from class org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection
addConnectionEventListener, associateConnection, broadcastConnectionError, checkException, checkState, checkValid, cleanup, getConnection, getLog, getLogWriter, getMetaData, getProperties, lock, removeConnectionEventListener, setLogWriter, tryLock, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xaConnection

protected final XAConnection xaConnection
The XA connection


xaResource

protected final XAResource xaResource
The XAResource


currentXid

protected Xid currentXid
The Xid

Constructor Detail

XAManagedConnection

public XAManagedConnection(XAManagedConnectionFactory mcf,
                           XAConnection xaConnection,
                           Properties props,
                           int transactionIsolation,
                           int psCacheSize)
                    throws SQLException
Constructor

Parameters:
mcf - The managed connection factory
xaConnection - The XA connection
props - The properties
transactionIsolation - The transaction isolation
psCacheSize - The prepared statement cache size
Throws:
SQLException - Thrown if an error occurs
Method Detail

begin

public void begin()
           throws javax.resource.ResourceException

Specified by:
begin in interface javax.resource.spi.LocalTransaction
Throws:
javax.resource.ResourceException

commit

public void commit()
            throws javax.resource.ResourceException

Specified by:
commit in interface javax.resource.spi.LocalTransaction
Throws:
javax.resource.ResourceException

rollback

public void rollback()
              throws javax.resource.ResourceException

Specified by:
rollback in interface javax.resource.spi.LocalTransaction
Throws:
javax.resource.ResourceException

broadcastConnectionError

protected void broadcastConnectionError(SQLException e)


getLocalTransaction

public javax.resource.spi.LocalTransaction getLocalTransaction()
                                                        throws javax.resource.ResourceException

Specified by:
getLocalTransaction in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

getXAResource

public XAResource getXAResource()
                         throws javax.resource.ResourceException

Specified by:
getXAResource in interface javax.resource.spi.ManagedConnection
Throws:
javax.resource.ResourceException

destroy

public void destroy()
             throws javax.resource.ResourceException
Destroy

Specified by:
destroy in interface javax.resource.spi.ManagedConnection
Overrides:
destroy in class BaseWrapperManagedConnection
Throws:
javax.resource.ResourceException - Thrown if an error occurs

start

public void start(Xid xid,
                  int flags)
           throws XAException

Specified by:
start in interface XAResource
Throws:
XAException

end

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

Specified by:
end in interface XAResource
Throws:
XAException

prepare

public int prepare(Xid xid)
            throws XAException

Specified by:
prepare in interface XAResource
Throws:
XAException

commit

public void commit(Xid xid,
                   boolean onePhase)
            throws XAException

Specified by:
commit in interface XAResource
Throws:
XAException

rollback

public void rollback(Xid xid)
              throws XAException

Specified by:
rollback in interface XAResource
Throws:
XAException

forget

public void forget(Xid xid)
            throws XAException

Specified by:
forget in interface XAResource
Throws:
XAException

recover

public Xid[] recover(int flag)
              throws XAException

Specified by:
recover in interface XAResource
Throws:
XAException

isSameRM

public boolean isSameRM(XAResource other)
                 throws XAException

Specified by:
isSameRM in interface XAResource
Throws:
XAException

getTransactionTimeout

public int getTransactionTimeout()
                          throws XAException

Specified by:
getTransactionTimeout in interface XAResource
Throws:
XAException

setTransactionTimeout

public boolean setTransactionTimeout(int seconds)
                              throws XAException

Specified by:
setTransactionTimeout in interface XAResource
Throws:
XAException

isXA

public boolean isXA()
Returns true if the underlying connection is handled by an XA resource manager

Specified by:
isXA in class BaseWrapperManagedConnection
Returns:
The value


Copyright © 2008 Red Hat Middleware LLC (http://www.jboss.com/)