|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tyrex.resource.jdbc.xa.XADataSourceImpl
Implements a JDBC 2.0 XADataSource
for any JDBC driver
with JNDI persistance support. The base implementation is actually
provided by a different DataSource
class; although this is
the super class, it only provides the pooling and XA specific
implementation.
Field Summary | |
static int |
DEFAULT_ISOLATION_LEVEL
The default isolation level is Read Committed |
static int |
DEFAULT_TX_TIMEOUT
The default timeout for all new transactions is 10 seconds. |
Constructor Summary | |
XADataSourceImpl()
Implementation details: If two XAConnections are associated with the same transaction (one with a start the other with a join) they must use the same underlying JDBC connection. |
Method Summary | |
void |
debug(java.io.PrintWriter writer)
|
boolean |
getIgnoreIsolationLevel()
Return true if the isolation level is ignored so that the isolation level is never set on the underlying JDBC connection. |
int |
getIsolationLevel()
Returns the transaction isolation level to use with all newly created transactions. |
abstract java.io.PrintWriter |
getLogWriter()
This method is defined in the interface and implemented in the derived class, we re-define it just to make sure it does not throw an SQLException and that we do not need to
catch one. |
javax.sql.PooledConnection |
getPooledConnection()
|
javax.sql.PooledConnection |
getPooledConnection(java.lang.String user,
java.lang.String password)
|
float |
getPruneFactor()
Get the factor that specifies the number of connections that are released from the pool. |
int |
getTransactionTimeout()
Returns the default timeout for all transactions. |
(package private) TxConnection |
getTxConnection(javax.transaction.xa.Xid xid)
Returns an underlying connection for the global transaction, if one has been associated before. |
(package private) javax.transaction.xa.Xid[] |
getTxRecover()
XXX Not fully implemented yet and no code to really test it. |
javax.sql.XAConnection |
getXAConnection()
|
javax.sql.XAConnection |
getXAConnection(java.lang.String user,
java.lang.String password)
|
(package private) java.sql.Connection |
newConnection(java.lang.String userName,
java.lang.String password)
Creates a new underlying connection. |
(package private) void |
releaseConnection(java.sql.Connection conn,
java.lang.String userName,
java.lang.String password)
Release an unused connection back to the pool. |
void |
run()
|
void |
setIgnoreIsolationLevel(boolean ignoreIsolationLevel)
Tell the data source whether to ignore the isolation level on the underlying JDBC connection. |
void |
setIsolationLevel(int isolationLevel)
Set the transaction isolation level to use with all newly created transactions. |
void |
setPruneFactor(float pruneFactor)
Set the factor that specifies the number of connections that are released from the pool. |
void |
setTransactionTimeout(int seconds)
Sets the default timeout for all new transactions. |
(package private) TxConnection |
setTxConnection(javax.transaction.xa.Xid xid,
TxConnection txConn)
Associates the global transaction with an underlying connection, or dissociate it when null is passed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.sql.DataSource |
getConnection, getConnection, getLoginTimeout, setLoginTimeout, setLogWriter |
Methods inherited from interface javax.sql.ConnectionPoolDataSource |
getLoginTimeout, setLoginTimeout, setLogWriter |
Methods inherited from interface javax.sql.XADataSource |
getLoginTimeout, setLoginTimeout, setLogWriter |
Field Detail |
public static final int DEFAULT_TX_TIMEOUT
public static final int DEFAULT_ISOLATION_LEVEL
Constructor Detail |
public XADataSourceImpl()
Method Detail |
public javax.sql.XAConnection getXAConnection() throws java.sql.SQLException
getXAConnection
in interface javax.sql.XADataSource
java.sql.SQLException
public javax.sql.XAConnection getXAConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
getXAConnection
in interface javax.sql.XADataSource
java.sql.SQLException
public javax.sql.PooledConnection getPooledConnection() throws java.sql.SQLException
getPooledConnection
in interface javax.sql.ConnectionPoolDataSource
java.sql.SQLException
public javax.sql.PooledConnection getPooledConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
getPooledConnection
in interface javax.sql.ConnectionPoolDataSource
java.sql.SQLException
public final int getTransactionTimeout()
public abstract java.io.PrintWriter getLogWriter()
SQLException
and that we do not need to
catch one.
getLogWriter
in interface javax.sql.DataSource
public final void setTransactionTimeout(int seconds)
default timeout
.
seconds
- The timeout in secondsTxConnection getTxConnection(javax.transaction.xa.Xid xid)
xid
- The transaction Xid
TxConnection setTxConnection(javax.transaction.xa.Xid xid, TxConnection txConn)
xid
- The transaction Xidvoid releaseConnection(java.sql.Connection conn, java.lang.String userName, java.lang.String password)
conn
- An open connection that is no longer in useuserName
- the user name for the connectionpassword
- the password for the connectionjava.sql.Connection newConnection(java.lang.String userName, java.lang.String password) throws java.sql.SQLException
userName
- the userNamepassword
- the password
java.sql.SQLException
- An error occured trying to open
a connectionjavax.transaction.xa.Xid[] getTxRecover()
public final boolean getIgnoreIsolationLevel()
getIsolationLevel()
,
setIsolationLevel(int)
public final void setIgnoreIsolationLevel(boolean ignoreIsolationLevel)
ignoreIsolationLevel
- true if the isolation level is ignoredgetIsolationLevel()
,
setIsolationLevel(int)
public final int getIsolationLevel()
getIgnoreIsolationLevel()
returns true the isloation
level is ignored.
getIgnoreIsolationLevel()
,
setIgnoreIsolationLevel(boolean)
public final void setIsolationLevel(int isolationLevel)
getIgnoreIsolationLevel()
returns true the isloation
level is ignored.
The isolation level of java.sql.Connection.TRANSACTION_NONE is not supported.
isolationLevel
- the new isolation level
java.lang.IllegalArgumentException
- if the specified isolation
level is not one of the following
java.sql.Connection.TRANSACTION_READ_UNCOMMITTED,
java.sql.Connection.TRANSACTION_READ_COMMITTED,
java.sql.Connection.TRANSACTION_REPEATABLE_READ,
java.sql.Connection.TRANSACTION_SERIALIZABLEgetIgnoreIsolationLevel()
,
setIgnoreIsolationLevel(boolean)
public final float getPruneFactor()
public final void setPruneFactor(float pruneFactor)
pruneFactor
- the prune factor. 0 <= pruneFactor <= 1public void run()
run
in interface java.lang.Runnable
public void debug(java.io.PrintWriter writer)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |