|
Oracle JDBC API Reference 11g Release 2 ("11.2.0.3.0") |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface OracleConnectionCache
An OracleConnectionCache is an interface one needs to implement if they like to reuse OracleConnectionEventListener and implement their own version of Connection Caching.
By extending DataSource, we would like to leverage the DataSource features such as JNDI and the concept of factory for Connection objects.
Simplifies the design of Cache implementation by shielding the necessity to understand the complexities of JDBC 2.0 Connection pooling 'hooks'. Here are the few basic steps a ConnectionCache class should do to complete the loop:
1) Create a new OracleConnectionEventListener and register the connection Cache as it's argument.
Ex: m_ocel = new OracleConnectionEventListener (this);
2) Register this event listener with new PooledConnections.
Ex: pc.addConnectionEventListener(m_ocel);
3) Deregister the listener when closing the PooledConnection
Ex: pc.removeConnectionEventListener(m_ocel);
Method Summary | |
---|---|
void |
close()
Close the connection cache. |
void |
closePooledConnection(javax.sql.PooledConnection pc)
Invoked by the ConnectionEventListener when an error occurs on a PooledConnection/LogicalConnection signaling that it is no longer good to be used and can be closed. |
void |
reusePooledConnection(javax.sql.PooledConnection pc)
Invoked by the ConnectionEventListener instance when Logical connection handles are closed signaling that the PooledConnection can be recycled into the pool for further use. |
Methods inherited from interface javax.sql.DataSource |
---|
getConnection, getConnection, getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter |
Method Detail |
---|
void reusePooledConnection(javax.sql.PooledConnection pc) throws java.sql.SQLException
Invoked by the ConnectionEventListener instance when Logical connection handles are closed signaling that the PooledConnection can be recycled into the pool for further use.
PooledConnection
- The pooled connection object that needs
to be recylced.
java.sql.SQLException
- error in recycling the PooledConnection.void closePooledConnection(javax.sql.PooledConnection pc) throws java.sql.SQLException
Invoked by the ConnectionEventListener when an error occurs on a PooledConnection/LogicalConnection signaling that it is no longer good to be used and can be closed.
PooledConnection
- The pooled connection object that has to
be closed because of an error.
java.sql.SQLException
- error in closing the PooledConnectionvoid close() throws java.sql.SQLException
java.sql.SQLException
- if error occurs closing the cache.
|
Oracle JDBC API Reference 11g Release 2 ("11.2.0.3.0") |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |