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, setUseEquals
protected PooledConnection connection
protected ConnectionPool pool
protected ProxyConnection(ConnectionPool parent, PooledConnection con, boolean useEquals)
public PooledConnection getConnection()
public void setConnection(PooledConnection connection)
public ConnectionPool getPool()
public void setPool(ConnectionPool pool)
public void reset(ConnectionPool parent, PooledConnection con)
JdbcInterceptor
reset
in class JdbcInterceptor
parent
- - the connection pool owning the connectioncon
- - the pooled connectionpublic boolean isWrapperFor(Class<?> iface)
public Object unwrap(Class<?> iface) throws SQLException
SQLException
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
JdbcInterceptor
Connection
is invoked.
invoke
in interface InvocationHandler
invoke
in class JdbcInterceptor
Throwable
public boolean isClosed()
public PooledConnection getDelegateConnection()
public ConnectionPool getParentPool()
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.