@Override public Object createStatement(Object proxy,Method method,Object[] args,Object statement,long time){
  try {
    String name=method.getName();
    Constructor<?> constructor=null;
    String sql=null;
    if (compare(CREATE_STATEMENT,name)) {
      constructor=getConstructor(CREATE_STATEMENT_IDX,Statement.class);
    }
 else     if (compare(PREPARE_STATEMENT,name)) {
      constructor=getConstructor(PREPARE_STATEMENT_IDX,PreparedStatement.class);
      sql=(String)args[0];
    }
 else     if (compare(PREPARE_CALL,name)) {
      constructor=getConstructor(PREPARE_CALL_IDX,CallableStatement.class);
      sql=(String)args[0];
    }
 else {
      return statement;
    }
    return createDecorator(proxy,method,args,statement,constructor,sql);
  }
 catch (  Exception x) {
    if (x instanceof InvocationTargetException) {
      Throwable cause=x.getCause();
      if (cause instanceof ThreadDeath) {
        throw (ThreadDeath)cause;
      }
      if (cause instanceof VirtualMachineError) {
        throw (VirtualMachineError)cause;
      }
    }
    logger.warn("Unable to create statement proxy for slow query report.",x);
  }
  return statement;
}

@ Override public Object createStatement ( Object proxy , Method method , Object [ ] args , Object statement , long time ) { try { String name = method . getName ( ) ; Constructor < ? > constructor = null ; String sql = null ; if ( compare ( CREATE_STATEMENT , name ) ) { constructor = getConstructor ( CREATE_STATEMENT_IDX , Statement . class ) ; } else if ( compare ( PREPARE_STATEMENT , name ) ) { constructor = getConstructor ( PREPARE_STATEMENT_IDX , PreparedStatement . class ) ; sql = ( String ) args [ 0 ] ; } else if ( compare ( PREPARE_CALL , name ) ) { constructor = getConstructor ( PREPARE_CALL_IDX , CallableStatement . class ) ; sql = ( String ) args [ 0 ] ; } else { return statement ; } return createDecorator ( proxy , method , args , statement , constructor , sql ) ; } catch ( Exception x ) { if ( x instanceof InvocationTargetException ) { Throwable cause = x . getCause ( ) ; if ( cause instanceof ThreadDeath ) { throw ( ThreadDeath ) cause ; } if ( cause instanceof VirtualMachineError ) { throw ( VirtualMachineError ) cause ; } } logger . warn ( "Unable to create statement proxy for slow query report." , x ) ; } return statement ; }
creates a statement interceptor to monitor query response times
