public class ProxyConnection extends JdbcInterceptor
PooledConnection. The ProxyConnection intercepts three methods:
Connection.close() - returns the connection to the pool. May be called multiple times.Object.toString() - returns a custom string for this objectPooledConnection.getConnection() - returns the underlying connectionPoolConfiguration.setUseEquals(boolean) has been called
with a true argument.| Modifier and Type | Field and Description |
|---|---|
protected PooledConnection |
connection |
protected ConnectionPool |
pool |
CLOSE_VAL, EQUALS_VAL, GETCONNECTION_VAL, HASHCODE_VAL, ISCLOSED_VAL, ISVALID_VAL, ISWRAPPERFOR_VAL, properties, TOSTRING_VAL, UNWRAP_VAL| Modifier | Constructor and Description |
|---|---|
protected |
ProxyConnection(ConnectionPool parent,
PooledConnection con,
boolean useEquals) |
| Modifier and Type | Method and Description |
|---|---|
PooledConnection |
getConnection() |
PooledConnection |
getDelegateConnection() |
ConnectionPool |
getParentPool() |
ConnectionPool |
getPool() |
Object |
invoke(Object proxy,
Method method,
Object[] args)
Gets invoked each time an operation on
Connection is invoked. |
boolean |
isClosed() |
boolean |
isWrapperFor(Class<?> iface) |
void |
reset(ConnectionPool parent,
PooledConnection con)
Gets called each time the connection is borrowed from the pool
This means that if an interceptor holds a reference to the connection
the interceptor can be reused for another connection.
|
void |
setConnection(PooledConnection connection) |
void |
setPool(ConnectionPool pool) |
String |
toString() |
Object |
unwrap(Class<?> iface) |
compare, compare, disconnected, getNext, getProperties, isUseEquals, poolClosed, poolStarted, setNext, setProperties, setUseEqualsprotected PooledConnection connection
protected ConnectionPool pool
protected ProxyConnection(ConnectionPool parent, PooledConnection con, boolean useEquals) throws SQLException
SQLExceptionpublic PooledConnection getConnection()
public void setConnection(PooledConnection connection)
public ConnectionPool getPool()
public void setPool(ConnectionPool pool)
public void reset(ConnectionPool parent, PooledConnection con)
JdbcInterceptorreset in class JdbcInterceptorparent - - the connection pool owning the connectioncon - - the pooled connectionpublic boolean isWrapperFor(Class<?> iface) throws SQLException
SQLExceptionpublic Object unwrap(Class<?> iface) throws SQLException
SQLExceptionpublic Object invoke(Object proxy, Method method, Object[] args) throws Throwable
JdbcInterceptorConnection is invoked.
invoke in interface InvocationHandlerinvoke in class JdbcInterceptorThrowablepublic boolean isClosed()
public PooledConnection getDelegateConnection()
public ConnectionPool getParentPool()
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.