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() |
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
Gets invoked each time an operation on
Connection is invoked. |
boolean |
isClosed() |
boolean |
isWrapperFor(java.lang.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) |
java.lang.String |
toString() |
java.lang.Object |
unwrap(java.lang.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) throws java.sql.SQLException
java.sql.SQLException
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(java.lang.Class<?> iface) throws java.sql.SQLException
java.sql.SQLException
public java.lang.Object unwrap(java.lang.Class<?> iface) throws java.sql.SQLException
java.sql.SQLException
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
JdbcInterceptor
Connection
is invoked.
invoke
in interface java.lang.reflect.InvocationHandler
invoke
in class JdbcInterceptor
java.lang.Throwable
public boolean isClosed()
public PooledConnection getDelegateConnection()
public ConnectionPool getParentPool()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.