org.enhydra.jdbc.standard
Class StandardXADataSource

java.lang.Object
  extended by org.enhydra.jdbc.util.JdbcUtil
      extended by org.enhydra.jdbc.core.CoreDataSource
          extended by org.enhydra.jdbc.standard.StandardDataSource
              extended by org.enhydra.jdbc.standard.StandardConnectionPoolDataSource
                  extended by org.enhydra.jdbc.standard.StandardXADataSource
All Implemented Interfaces:
java.io.Serializable, javax.naming.Referenceable, javax.naming.spi.ObjectFactory, javax.sql.ConnectionPoolDataSource, javax.sql.DataSource, javax.sql.XADataSource
Direct Known Subclasses:
IdbXADataSource, InformixXADataSource, OracleXADataSource, SybaseXADataSource

public class StandardXADataSource
extends StandardConnectionPoolDataSource
implements javax.sql.XADataSource

Data source for creating StandardXAConnections.

See Also:
Serialized Form

Field Summary
 int connectionCount
           
 long deadLockMaxWait
           
 long deadLockRetryWait
           
static long DEFAULT_DEADLOCKMAXWAIT
           
static int DEFAULT_DEADLOCKRETRYWAIT
           
static int DEFAULT_MAX_CON
           
static int DEFAULT_MIN_CON
           
 int maxCon
           
 int minCon
           
 javax.transaction.TransactionManager transactionManager
           
 
Fields inherited from class org.enhydra.jdbc.standard.StandardConnectionPoolDataSource
DEFAULT_PREPAREDSTMTCACHESIZE
 
Fields inherited from class org.enhydra.jdbc.core.CoreDataSource
logWriter, password, user
 
Fields inherited from class org.enhydra.jdbc.util.JdbcUtil
log
 
Constructor Summary
StandardXADataSource()
          Constructor
 
Method Summary
 void closeFreeConnection()
           
 void dump()
           
 void freeConnection(javax.transaction.xa.Xid id, boolean placeAtStart)
          Frees a connection to make it eligible for reuse.
 int getAllConnections()
           
 int getConnectionCount()
           
 long getDeadLockMaxWait()
           
 long getDeadLockRetryWait()
           
 int getMaxCon()
           
 int getMinCon()
           
 javax.transaction.TransactionManager getTransactionManager()
           
 javax.sql.XAConnection getXAConnection()
          Creates an XA connection using the default username and password.
 javax.sql.XAConnection getXAConnection(java.lang.String user, java.lang.String password)
          Creates an XA connection using the supplied username and password.
 java.util.Hashtable getXidConnections()
           
 int getXidCount()
          Returns the number of connections that are either prepared or heuristically completed.
 void processToWait()
           
 void setDeadLockMaxWait(long deadLock)
           
 void setDeadLockRetryWait(long deadLockRetryWait)
           
 void setDriverName(java.lang.String driverName)
          set the name of the jdbc driver
 void setMaxCon(int max)
           
 void setMinCon(int min)
           
 void setPassword(java.lang.String password)
           
 void setTransactionManager(javax.transaction.TransactionManager tm)
           
 void setUrl(java.lang.String url)
          set the database url
 void setUser(java.lang.String user)
           
 java.lang.String toString()
           
 
Methods inherited from class org.enhydra.jdbc.standard.StandardConnectionPoolDataSource
getMasterPrepStmtCache, getPooledConnection, getPooledConnection, getPreparedStmtCacheSize, setPreparedStmtCacheSize
 
Methods inherited from class org.enhydra.jdbc.standard.StandardDataSource
equals, getConnection, getConnection, getDriverName, getObjectInstance, getReference, getTransactionIsolation, getUrl, hashCode, setTransactionIsolation
 
Methods inherited from class org.enhydra.jdbc.core.CoreDataSource
getDescription, getLoginTimeout, getLogWriter, getPassword, getThreadFactory, getUser, isDebug, isVerbose, setDebug, setDescription, setLoginTimeout, setLogWriter, setThreadFactory, setVerbose, shutdown
 
Methods inherited from class org.enhydra.jdbc.util.JdbcUtil
setLogger
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.sql.XADataSource
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 
Methods inherited from interface javax.sql.ConnectionPoolDataSource
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 
Methods inherited from interface javax.sql.DataSource
getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
 

Field Detail

minCon

public int minCon

maxCon

public int maxCon

deadLockMaxWait

public long deadLockMaxWait

connectionCount

public int connectionCount

deadLockRetryWait

public long deadLockRetryWait

transactionManager

public transient javax.transaction.TransactionManager transactionManager

DEFAULT_MIN_CON

public static final int DEFAULT_MIN_CON
See Also:
Constant Field Values

DEFAULT_MAX_CON

public static final int DEFAULT_MAX_CON
See Also:
Constant Field Values

DEFAULT_DEADLOCKMAXWAIT

public static final long DEFAULT_DEADLOCKMAXWAIT
See Also:
Constant Field Values

DEFAULT_DEADLOCKRETRYWAIT

public static final int DEFAULT_DEADLOCKRETRYWAIT
See Also:
Constant Field Values
Constructor Detail

StandardXADataSource

public StandardXADataSource()
Constructor

Method Detail

getConnectionCount

public int getConnectionCount()

getXidConnections

public java.util.Hashtable getXidConnections()

getXAConnection

public javax.sql.XAConnection getXAConnection()
                                       throws java.sql.SQLException
Creates an XA connection using the default username and password.

Specified by:
getXAConnection in interface javax.sql.XADataSource
Throws:
java.sql.SQLException

getXAConnection

public javax.sql.XAConnection getXAConnection(java.lang.String user,
                                              java.lang.String password)
                                       throws java.sql.SQLException
Creates an XA connection using the supplied username and password.

Specified by:
getXAConnection in interface javax.sql.XADataSource
Throws:
java.sql.SQLException

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager tm)

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()

setUser

public void setUser(java.lang.String user)
Overrides:
setUser in class CoreDataSource

setPassword

public void setPassword(java.lang.String password)
Overrides:
setPassword in class CoreDataSource

setUrl

public void setUrl(java.lang.String url)
Description copied from class: StandardDataSource
set the database url

Overrides:
setUrl in class StandardDataSource
Parameters:
url - the string representation of the database url

setDriverName

public void setDriverName(java.lang.String driverName)
                   throws java.sql.SQLException
Description copied from class: StandardDataSource
set the name of the jdbc driver

Overrides:
setDriverName in class StandardDataSource
Parameters:
driverName - the string representation of the jdbc driver name
Throws:
java.sql.SQLException

getXidCount

public int getXidCount()
Returns the number of connections that are either prepared or heuristically completed.


freeConnection

public void freeConnection(javax.transaction.xa.Xid id,
                           boolean placeAtStart)
Frees a connection to make it eligible for reuse. The free list is normally a last in, first out list (LIFO). This is efficient. However, timed out connections are nice to hang onto for error reporting, so they can be placed at the start. This is less efficient, but hopefully is a rare occurence. Here, no need to verify the number of connections, we remove an object from the xidConnections to put it in th freeConnections


closeFreeConnection

public void closeFreeConnection()

setMinCon

public void setMinCon(int min)

setMaxCon

public void setMaxCon(int max)

setDeadLockMaxWait

public void setDeadLockMaxWait(long deadLock)

getMinCon

public int getMinCon()

getMaxCon

public int getMaxCon()

getDeadLockMaxWait

public long getDeadLockMaxWait()

getAllConnections

public int getAllConnections()

processToWait

public void processToWait()
                   throws java.lang.Exception
Throws:
java.lang.Exception

dump

public void dump()

setDeadLockRetryWait

public void setDeadLockRetryWait(long deadLockRetryWait)

getDeadLockRetryWait

public long getDeadLockRetryWait()

toString

public java.lang.String toString()
Overrides:
toString in class StandardConnectionPoolDataSource