@Override
public Connection getConnection() throws SQLException {
- return (Connection) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Connection.class }, new ProfilingConnectionHandler(delegate.getConnection()));
+ return (Connection) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Connection.class },
+ new ProfilingConnectionHandler(delegate.getConnection()));
}
@Override
public Connection getConnection(String user, String pass) throws SQLException {
- return (Connection) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Connection.class }, new ProfilingConnectionHandler(delegate.getConnection(user, pass)));
+ return (Connection) Proxy.newProxyInstance(this.getClass().getClassLoader(), new Class[] { Connection.class },
+ new ProfilingConnectionHandler(delegate.getConnection(user, pass)));
}
@Override
class ProfilingPreparedStatementHandler implements InvocationHandler {
- private static final SqlProfiling profiling = new SqlProfiling();
+ private static final SqlProfiling PROFILING = new SqlProfiling();
private final PreparedStatement statement;
private final String sql;
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getName().startsWith("execute")) {
- StopWatch watch = profiling.start();
+ StopWatch watch = PROFILING.start();
Object result = method.invoke(statement, args);
- profiling.stop(watch, sql);
+ PROFILING.stop(watch, sql);
return result;
} else {
return method.invoke(statement, args);
class ProfilingStatementHandler implements InvocationHandler {
- private static final SqlProfiling profiling = new SqlProfiling();
+ private static final SqlProfiling PROFILING = new SqlProfiling();
private final Statement statement;
ProfilingStatementHandler(Statement statement) {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getName().startsWith("execute")) {
- StopWatch watch = profiling.start();
+ StopWatch watch = PROFILING.start();
Object result = method.invoke(statement, args);
- profiling.stop(watch, (String) args[0]);
+ PROFILING.stop(watch, (String) args[0]);
return result;
} else {
return method.invoke(statement, args);