private CallableStatement monitor(final CallableStatement statement, final String sql) {
return CallableStatement.class.cast(Proxy.newProxyInstance(ClassLoaders.current(), new Class<?>[]{CallableStatement.class}, new MonitoredPreparedStatement(statement, sql)));
}
public static Connection monitor(final Connection connection, final Counter counter) {
final StopWatch stopWatch = new CounterStopWatch(counter);
return Connection.class.cast(Proxy.newProxyInstance(ClassLoaders.current(), new Class<?>[]{Connection.class}, new MonitoredConnection(connection, stopWatch)));
}