org.hibernate.jdbc
Class BorrowedConnectionProxy
java.lang.Object
org.hibernate.jdbc.BorrowedConnectionProxy
- InvocationHandler
public class BorrowedConnectionProxy
extends java.lang.Object
implements InvocationHandler
A proxy for
borrowed connections which funnels all requests back
into the ConnectionManager from which it was borrowed to be properly
handled (in terms of connection release modes).
Note: the term borrowed here refers to connection references obtained
via
Session.connection()
for application usage.
static Connection | generateProxy(ConnectionManager connectionManager) - Generates a Connection proxy wrapping the connection managed by the passed
connection manager.
|
static ClassLoader | getProxyClassLoader() - Determines the appropriate class loader to which the generated proxy
should be scoped.
|
static Connection | getWrappedConnection(Connection connection) - Convience method for unwrapping a connection proxy and getting a
handle to an underlying connection.
|
Object | invoke(Object proxy, Method method, Object[] args) -
|
static void | renderUnuseable(Connection connection) - Marks a borrowed connection as no longer usable.
|
BorrowedConnectionProxy
public BorrowedConnectionProxy(ConnectionManager connectionManager)
generateProxy
public static Connection generateProxy(ConnectionManager connectionManager)
Generates a Connection proxy wrapping the connection managed by the passed
connection manager.
connectionManager
- The connection manager to wrap with the
connection proxy.
getProxyClassLoader
public static ClassLoader getProxyClassLoader()
Determines the appropriate class loader to which the generated proxy
should be scoped.
- The class loader appropriate for proxy construction.
getWrappedConnection
public static Connection getWrappedConnection(Connection connection)
Convience method for unwrapping a connection proxy and getting a
handle to an underlying connection.
connection
- The connection (proxy) to be unwrapped.
- The unwrapped connection.
invoke
public Object invoke(Object proxy,
Method method,
Object[] args)
throws Throwable
renderUnuseable
public static void renderUnuseable(Connection connection)
Marks a borrowed connection as no longer usable.
connection
- The connection (proxy) to be marked.