|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jboss.minerva.jdbc.ConnectionInPool
Wrapper for database connections in a pool. Handles closing appropriately. The connection is returned to the pool rather than truly closing, any outstanding statements are closed, and the connection is rolled back. This class is also used by statements, etc. to update the last used time for the connection.
Fields inherited from interface java.sql.Connection |
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
Constructor Summary | |
ConnectionInPool(java.sql.Connection con)
Creates a new connection wrapper. |
Method Summary | |
void |
addPoolEventListener(PoolEventListener listener)
Adds a listener for pool events. |
void |
clearWarnings()
|
void |
close()
|
void |
commit()
|
java.sql.Statement |
createStatement()
|
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
|
protected void |
firePoolEvent(PoolEvent evt)
Dispatches an event to the listeners. |
boolean |
getAutoCommit()
|
java.lang.String |
getCatalog()
|
java.sql.DatabaseMetaData |
getMetaData()
|
int |
getTransactionIsolation()
|
java.util.Map |
getTypeMap()
|
java.sql.Connection |
getUnderlyingConnection()
Gets a reference to the "real" connection. |
java.sql.SQLWarning |
getWarnings()
|
boolean |
isClosed()
|
boolean |
isReadOnly()
|
java.lang.String |
nativeSQL(java.lang.String sql)
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
|
void |
removePoolEventListener(PoolEventListener listener)
Removes a listener for pool events. |
void |
reset()
Prepares a connection to be returned to the pool. |
void |
rollback()
|
void |
setAutoCommit(boolean autoCommit)
|
void |
setCatalog(java.lang.String catalog)
|
void |
setCatastrophicError(java.sql.SQLException e)
Indicates that an error occured on this connection. |
void |
setError(java.sql.SQLException e)
Indicates that an error occured on this connection. |
void |
setLastUsed()
Updates the last used time for this connection to the current time. |
void |
setReadOnly(boolean readOnly)
|
void |
setTransactionIsolation(int level)
|
void |
setTypeMap(java.util.Map map)
|
void |
shutdown()
Closes this connection wrapper permanently. |
void |
statementClosed(java.sql.Statement st)
Indicates that a statement has been closed and no longer needs to be tracked. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ConnectionInPool(java.sql.Connection con)
con
- The "real" database connection to wrap.pool
- The database pool this connection came from.Method Detail |
public void addPoolEventListener(PoolEventListener listener)
addPoolEventListener
in interface PooledObject
public void removePoolEventListener(PoolEventListener listener)
removePoolEventListener
in interface PooledObject
public java.sql.Connection getUnderlyingConnection()
public void shutdown()
public void setLastUsed()
setLastUsed
in interface ConnectionWrapper
public void setError(java.sql.SQLException e)
setError
in interface ConnectionWrapper
public void setCatastrophicError(java.sql.SQLException e)
public void statementClosed(java.sql.Statement st)
statementClosed
in interface ConnectionWrapper
public void reset() throws java.sql.SQLException
protected void firePoolEvent(PoolEvent evt)
public java.sql.Statement createStatement() throws java.sql.SQLException
createStatement
in interface java.sql.Connection
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLException
nativeSQL
in interface java.sql.Connection
public void setAutoCommit(boolean autoCommit) throws java.sql.SQLException
setAutoCommit
in interface java.sql.Connection
public boolean getAutoCommit() throws java.sql.SQLException
getAutoCommit
in interface java.sql.Connection
public void commit() throws java.sql.SQLException
commit
in interface java.sql.Connection
public void rollback() throws java.sql.SQLException
rollback
in interface java.sql.Connection
public void close() throws java.sql.SQLException
close
in interface java.sql.Connection
public boolean isClosed() throws java.sql.SQLException
isClosed
in interface java.sql.Connection
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException
getMetaData
in interface java.sql.Connection
public void setReadOnly(boolean readOnly) throws java.sql.SQLException
setReadOnly
in interface java.sql.Connection
public boolean isReadOnly() throws java.sql.SQLException
isReadOnly
in interface java.sql.Connection
public void setCatalog(java.lang.String catalog) throws java.sql.SQLException
setCatalog
in interface java.sql.Connection
public java.lang.String getCatalog() throws java.sql.SQLException
getCatalog
in interface java.sql.Connection
public void setTransactionIsolation(int level) throws java.sql.SQLException
setTransactionIsolation
in interface java.sql.Connection
public int getTransactionIsolation() throws java.sql.SQLException
getTransactionIsolation
in interface java.sql.Connection
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
getWarnings
in interface java.sql.Connection
public void clearWarnings() throws java.sql.SQLException
clearWarnings
in interface java.sql.Connection
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
createStatement
in interface java.sql.Connection
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
prepareCall
in interface java.sql.Connection
public java.util.Map getTypeMap() throws java.sql.SQLException
getTypeMap
in interface java.sql.Connection
public void setTypeMap(java.util.Map map) throws java.sql.SQLException
setTypeMap
in interface java.sql.Connection
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |