use of com.jolbox.bonecp.ConnectionHandle in project druid by alibaba.
the class TestPSCache method unwrap.
public static MockConnection unwrap(Connection conn) throws Exception {
if (conn instanceof ConnectionHandle) {
ConnectionHandle handle = (ConnectionHandle) conn;
return (MockConnection) handle.getInternalConnection();
}
if (conn instanceof NewProxyConnection) {
NewProxyConnection handle = (NewProxyConnection) conn;
Field field = NewProxyConnection.class.getDeclaredField("inner");
field.setAccessible(true);
return (MockConnection) field.get(handle);
}
return conn.unwrap(MockConnection.class);
}
use of com.jolbox.bonecp.ConnectionHandle in project druid by alibaba.
the class TestLRU method unwrap.
public static MockConnection unwrap(Connection conn) throws Exception {
if (conn instanceof ConnectionHandle) {
ConnectionHandle handle = (ConnectionHandle) conn;
return (MockConnection) handle.getInternalConnection();
}
if (conn instanceof NewProxyConnection) {
NewProxyConnection handle = (NewProxyConnection) conn;
Field field = NewProxyConnection.class.getDeclaredField("inner");
field.setAccessible(true);
return (MockConnection) field.get(handle);
}
return conn.unwrap(MockConnection.class);
}
Aggregations