|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.avalon.excalibur.datasource.AbstractJdbcConnection
public class AbstractJdbcConnection
The Connection object used in conjunction with the JdbcDataSource object.
Field Summary | |
---|---|
protected 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 SQLException |
m_testException
|
protected PreparedStatement |
m_testStatement
|
Constructor Summary | |
---|---|
AbstractJdbcConnection(Connection connection,
boolean oradb)
Deprecated. Use the version with keepAlive specified |
|
AbstractJdbcConnection(Connection connection,
String keepAlive)
|
|
AbstractJdbcConnection(Connection connection,
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()
|
void |
enableLogging(Logger log)
|
boolean |
equals(Object obj)
|
Connection |
getConnection()
|
void |
initialize()
|
Object |
invoke(Object proxy,
Method method,
Object[] args)
|
boolean |
isClosed()
|
void |
recycle()
|
protected void |
registerAllocatedStatement(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(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 Connection m_connection
protected Pool m_pool
protected boolean m_encounteredError
protected int m_testAge
protected PreparedStatement m_testStatement
protected SQLException m_testException
protected long m_lastUsed
Constructor Detail |
---|
public AbstractJdbcConnection(Connection connection, boolean oradb)
public AbstractJdbcConnection(Connection connection, 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(Connection connection, 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)
enableLogging
in interface LogEnabled
enableLogging
in class AbstractLogEnabled
public void setPool(Pool pool)
PoolSettable
setPool
in interface PoolSettable
public void recycle()
recycle
in interface Recyclable
public void setProxiedConnection(Object proxy)
setProxiedConnection
in interface ProxiedJdbcConnection
public Connection getConnection()
getConnection
in interface ProxiedJdbcConnection
public boolean isClosed() throws SQLException
SQLException
public void close() throws SQLException
SQLException
protected void clearAllocatedStatements() throws 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.
SQLException
- of the first Statement.close()protected void registerAllocatedStatement(Statement stmt)
public void dispose()
dispose
in interface Disposable
public boolean equals(Object obj)
equals
in class Object
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |