|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avalon.framework.logger.AbstractLogEnabled org.apache.avalon.excalibur.datasource.AbstractJdbcConnection
The Connection object used in conjunction with the JdbcDataSource object.
Field Summary | |
protected java.sql.Connection |
m_connection
|
protected boolean |
m_encounteredError
Flag to keep track of whether or not an error has been thrown since the last time the DB was pinged. |
protected long |
m_lastUsed
|
protected Pool |
m_pool
|
protected int |
m_testAge
The maximum time since a connection was last used before it will be pinged. |
protected java.sql.SQLException |
m_testException
|
protected java.sql.PreparedStatement |
m_testStatement
|
Constructor Summary | |
AbstractJdbcConnection(java.sql.Connection connection,
boolean oradb)
Deprecated. Use the version with keepAlive specified |
|
AbstractJdbcConnection(java.sql.Connection connection,
java.lang.String keepAlive)
|
|
AbstractJdbcConnection(java.sql.Connection connection,
java.lang.String keepAlive,
int keepAliveAge)
|
Method Summary | |
protected void |
clearAllocatedStatements()
Closes statements that were registered and removes all statements from the list of allocated ones. |
void |
close()
|
void |
dispose()
The dispose operation is called at the end of a components lifecycle. |
void |
enableLogging(Logger log)
Set the components logger. |
boolean |
equals(java.lang.Object obj)
|
java.sql.Connection |
getConnection()
|
void |
initialize()
|
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
boolean |
isClosed()
|
void |
recycle()
This method should be implemented to remove all costly resources in object. |
protected void |
registerAllocatedStatement(java.sql.Statement stmt)
Adds the statement to the list of this connection. |
void |
setPool(Pool pool)
Set the pool that will be used to recycle. |
void |
setProxiedConnection(java.lang.Object proxy)
|
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.sql.Connection m_connection
protected Pool m_pool
protected boolean m_encounteredError
protected int m_testAge
protected java.sql.PreparedStatement m_testStatement
protected java.sql.SQLException m_testException
protected long m_lastUsed
Constructor Detail |
public AbstractJdbcConnection(java.sql.Connection connection, boolean oradb)
public AbstractJdbcConnection(java.sql.Connection connection, java.lang.String keepAlive)
connection
- a driver specific JDBC connection to be wrapped.keepAlive
- a query which will be used to check the statis of the connection after it
has been idle. A null value will cause the keep alive feature to
be disabled.public AbstractJdbcConnection(java.sql.Connection connection, java.lang.String keepAlive, int keepAliveAge)
connection
- a driver specific JDBC connection to be wrapped.keepAlive
- a query which will be used to check the status of the connection after it
has been idle. A null value will cause the keep alive feature to
be disabled.keepAliveAge
- the maximum age in milliseconds since a connection was last
used before it must be pinged using the keepAlive query. Ignored
if keepAlive is null.Method Detail |
public void initialize()
public void enableLogging(Logger log)
AbstractLogEnabled
enableLogging
in interface LogEnabled
enableLogging
in class AbstractLogEnabled
log
- the loggerpublic void setPool(Pool pool)
PoolSettable
setPool
in interface PoolSettable
pool
- public void recycle()
Recyclable
recycle
in interface Recyclable
public void setProxiedConnection(java.lang.Object proxy)
setProxiedConnection
in interface ProxiedJdbcConnection
public java.sql.Connection getConnection()
getConnection
in interface ProxiedJdbcConnection
public boolean isClosed() throws java.sql.SQLException
java.sql.SQLException
public void close() throws java.sql.SQLException
java.sql.SQLException
protected void clearAllocatedStatements() throws java.sql.SQLException
Holds m_allocatedStatements locked the whole time. This should not be a problem because connections are inherently single threaded objects and any attempt to use them from a different thread while it is being closed is a violation of the contract.
java.sql.SQLException
- of the first Statement.close()protected void registerAllocatedStatement(java.sql.Statement stmt)
public void dispose()
Disposable
dispose
in interface Disposable
public boolean equals(java.lang.Object obj)
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface java.lang.reflect.InvocationHandler
java.lang.Throwable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |