org.enhydra.jdbc.instantdb
Class IdbXAConnection

java.lang.Object
  extended by org.enhydra.jdbc.standard.StandardPooledConnection
      extended by org.enhydra.jdbc.standard.StandardXAConnection
          extended by org.enhydra.jdbc.instantdb.IdbXAConnection
All Implemented Interfaces:
java.lang.Runnable, javax.naming.Referenceable, javax.sql.PooledConnection, javax.sql.XAConnection, javax.transaction.xa.XAResource

public final class IdbXAConnection
extends StandardXAConnection

Provides and InstantDB specific instance of StandardXAConnection. Almost all of the required functionality is provided curtesy of the generic super class which looks after most of the transaction state management. InstantDB's own Transaction object is informed that it is part of a global transaction and looks after the detail thereafter.


Field Summary
 
Fields inherited from class org.enhydra.jdbc.standard.StandardXAConnection
connectionHandle, curCon, thisAutoCommit, timerThread, transactionManager, xaDataSource
 
Fields inherited from class org.enhydra.jdbc.standard.StandardPooledConnection
con, dataSource, log
 
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY
 
Constructor Summary
IdbXAConnection(StandardXADataSource dataSource, java.lang.String user, java.lang.String password)
          Creates the first free connection.
 
Method Summary
 boolean isSameRM(javax.transaction.xa.XAResource xares)
          Checks to see if two XAResource objects correspond to the same Resource Manager.
 int prepare(javax.transaction.xa.Xid xid)
          Prepares to perform a commit.
 void start(javax.transaction.xa.Xid xid, int flags)
          Associates this XAConnection with a global transaction.
 
Methods inherited from class org.enhydra.jdbc.standard.StandardXAConnection
checkPreparedState, close, commit, doStart, end, forget, getCommitOnPrepare, getConnection, getReference, getTransactionTimeout, getXAResource, newConnectionHandle, recover, rollback, run, setCommitOnPrepare, setTransactionManager, setTransactionTimeout, toString
 
Methods inherited from class org.enhydra.jdbc.standard.StandardPooledConnection
addConnectionEventListener, connectionErrorOccurred, getPhysicalConnection, removeConnectionEventListener, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.sql.PooledConnection
addConnectionEventListener, addStatementEventListener, removeConnectionEventListener, removeStatementEventListener
 

Constructor Detail

IdbXAConnection

public IdbXAConnection(StandardXADataSource dataSource,
                       java.lang.String user,
                       java.lang.String password)
                throws java.sql.SQLException
Creates the first free connection.

Throws:
java.sql.SQLException
Method Detail

start

public void start(javax.transaction.xa.Xid xid,
                  int flags)
           throws javax.transaction.xa.XAException
Associates this XAConnection with a global transaction. This is the only method which can associate the current connection with a global transaction. It acts only on the current connection which must have been previously established using getConnection.

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

prepare

public int prepare(javax.transaction.xa.Xid xid)
            throws javax.transaction.xa.XAException
Prepares to perform a commit.

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

isSameRM

public boolean isSameRM(javax.transaction.xa.XAResource xares)
                 throws javax.transaction.xa.XAException
Checks to see if two XAResource objects correspond to the same Resource Manager. This can go one better than its super class as it can actually check the InstantDB database objects.

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