@Override protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable { Object ret; try { ret = method.invoke(delegate, args); } catch (InvocationTargetException e) { throw e.getTargetException(); } if (method.getName().equals("getConnection")) { Connection conn = (Connection) ret; conn = InterceptorConnection.wrapInterceptor(conn); onAcquire(conn); ret = conn; } return ret; }
private static DataSource wrapDataSourceWithVisitor(DataSource ds, final Visitor<Connection> visitor) { return InterceptorDataSource.wrapInterceptor(new InterceptorDataSource(ds) { @Override protected void onAcquire(Connection conn) { visitor.visit(conn); } }); }
private static DataSource wrapDataSourceWithVisitor(DataSource ds, final Visitor<Connection> visitor) { return InterceptorDataSource.wrapInterceptor(new InterceptorDataSource(ds) { @Override protected void onAcquire(Connection conn) { visitor.visit(conn); } }); }
@Override protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable { Object ret; try { ret = method.invoke(delegate, args); } catch (InvocationTargetException e) { throw e.getTargetException(); } if (method.getName().equals("getConnection")) { Connection conn = (Connection) ret; conn = InterceptorConnection.wrapInterceptor(conn); onAcquire(conn); ret = conn; } return ret; }