Exemple #1
0
    protected void generateDelegateCode(
        Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException {

      String mname = method.getName();
      if (jdbc4WrapperMethod(mname)) {
        generateWrapperDelegateCode(intfcl, genclass, method, iw);
        return;
      }

      Class retType = method.getReturnType();

      iw.println("if (proxyConn != null) proxyConn.maybeDirtyTransaction();");
      iw.println();

      if (mname.equals("close")) {
        iw.println("if (! this.isDetached())");
        iw.println("{");
        iw.upIndent();

        iw.println("if (creator instanceof Statement)");
        iw.upIndent();
        iw.println(
            "parentPooledConnection.markInactiveResultSetForStatement( (Statement) creator, inner );");
        iw.downIndent();
        iw.println("else if (creator instanceof DatabaseMetaData)");
        iw.upIndent();
        iw.println("parentPooledConnection.markInactiveMetaDataResultSet( inner );");
        iw.downIndent();
        iw.println("else if (creator instanceof Connection)");
        iw.upIndent();
        iw.println("parentPooledConnection.markInactiveRawConnectionResultSet( inner );");
        iw.downIndent();
        iw.println(
            "else throw new InternalError(\042Must be Statement or DatabaseMetaData -- Bad Creator: \042 + creator);");

        iw.println(
            "if (creatorProxy instanceof ProxyResultSetDetachable) ((ProxyResultSetDetachable) creatorProxy).detachProxyResultSet( this );");

        iw.println("this.detach();");
        iw.println("inner.close();");
        iw.println("this.inner = null;");

        iw.downIndent();
        iw.println("}");
      } else if (mname.equals("getStatement")) {
        iw.println("if (creator instanceof Statement)");
        iw.upIndent();
        iw.println("return (Statement) creatorProxy;");
        iw.downIndent();
        iw.println("else if (creator instanceof DatabaseMetaData)");
        iw.upIndent();
        iw.println("return null;");
        iw.downIndent();
        iw.println(
            "else throw new InternalError(\042Must be Statement or DatabaseMetaData -- Bad Creator: \042 + creator);");
      } else if (mname.equals("isClosed")) {
        iw.println("return this.isDetached();");
      } else super.generateDelegateCode(intfcl, genclass, method, iw);
    }
Exemple #2
0
 public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
   try {
     String method = m.getName();
     if ("prepareStatement".equals(method) || "createStatement".equals(method))
       log.info("[SQL] >>> " + args[0]);
     return m.invoke(conn, args);
   } catch (InvocationTargetException e) {
     throw e.getTargetException();
   }
 }
 public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
   Object obj = null;
   if (CLOSE_METHOD_NAME.equals(m.getName())) {
     SimpleConnectionPool.pushConnectionBackToPool(this);
   } else {
     obj = m.invoke(m_originConnection, args);
   }
   lastAccessTime = System.currentTimeMillis();
   return obj;
 }
Exemple #4
0
    protected void generatePostDelegateCode(
        Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException {
      if ("setClientInfo".equals(method.getName())) {
        super.generatePostDelegateCode(intfcl, genclass, method, iw);

        iw.downIndent();
        iw.println("}");
        iw.println("catch (Exception e)");
        iw.println("{ throw SqlUtils.toSQLClientInfoException( e ); }");
      } else super.generatePostDelegateCode(intfcl, genclass, method, iw);
    }
Exemple #5
0
    protected void generatePreDelegateCode(
        Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException {
      if ("setClientInfo".equals(method.getName())) {
        iw.println("try");
        iw.println("{");
        iw.upIndent();

        super.generatePreDelegateCode(intfcl, genclass, method, iw);

      } else super.generatePreDelegateCode(intfcl, genclass, method, iw);
    }
Exemple #6
0
 private static void generateWrapperDelegateCode(
     Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException {
   String mname = method.getName();
   if ("isWrapperFor".equals(mname)) {
     iw.println("return ( isWrapperForInner( a ) || isWrapperForThis( a ) );");
   } else if ("unwrap".equals(mname)) {
     iw.println("if (this.isWrapperForInner( a )) return inner.unwrap( a );");
     iw.println("if (this.isWrapperForThis( a )) return this;");
     iw.println(
         "else throw new SQLException( this + \042 is not a wrapper for or implementation of \042 + a.getName());");
   }
 }
 public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
   if (state != STATE_IDLE) {
     String methodName = method.getName();
     if (methodName.equals("commit")
         || methodName.equals("rollback")
         || methodName.equals("setSavePoint")
         || (methodName.equals("setAutoCommit") && ((Boolean) args[0]).booleanValue())) {
       throw new PSQLException(
           GT.tr(
               "Transaction control methods setAutoCommit(true), commit, rollback and setSavePoint not allowed while an XA transaction is active."),
           PSQLState.OBJECT_NOT_IN_STATE);
     }
   }
   try {
     return method.invoke(con, args);
   } catch (InvocationTargetException ex) {
     throw ex.getTargetException();
   }
 }
Exemple #8
0
    protected void generateDelegateCode(
        Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException {
      String mname = method.getName();
      if (jdbc4WrapperMethod(mname)) {
        generateWrapperDelegateCode(intfcl, genclass, method, iw);
        return;
      }

      Class retType = method.getReturnType();

      if (ResultSet.class.isAssignableFrom(retType)) {
        iw.println("ResultSet innerResultSet = inner." + CodegenUtils.methodCall(method) + ";");
        iw.println("if (innerResultSet == null) return null;");
        iw.println(
            "return new NewProxyResultSet( innerResultSet, parentPooledConnection, inner, this );");
      } else if (mname.equals("getConnection")) {
        iw.println("return this.proxyCon;");
      } else super.generateDelegateCode(intfcl, genclass, method, iw);
    }
  /**
   * Enumerate the methods of the Clob interface and get the list of methods present in the
   * interface
   *
   * @param LOB an instance of the Clob interface implementation
   */
  void buildMethodList(Object LOB) throws IllegalAccessException, InvocationTargetException {
    // If the given method throws the correct exception
    // set this to true and add it to the
    boolean valid = true;

    // create a list of the methods that fail the test
    Vector<Method> methodList = new Vector<Method>();

    // The class whose methods are to be verified
    Class clazz = Clob.class;

    // The list of the methods in the class that need to be invoked
    // and verified
    Method[] methods = clazz.getMethods();

    // Check each of the methods to ensure that
    // they throw the required exception
    for (int i = 0; i < methods.length; i++) {
      if (!checkIfExempted(methods[i])) {
        valid = checkIfMethodThrowsSQLException(LOB, methods[i]);

        // add the method to the list if the method does
        // not throw the required exception
        if (valid == false) methodList.add(methods[i]);

        // reset valid
        valid = true;
      }
    }

    if (!methodList.isEmpty()) {
      int c = 0;
      String failureMessage = "The Following methods don't throw " + "required exception - ";
      for (Method m : methodList) {
        c = c + 1;
        if (c == methodList.size() && c != 1) failureMessage += " & ";
        else if (c != 1) failureMessage += " , ";
        failureMessage += m.getName();
      }
      fail(failureMessage);
    }
  }
Exemple #10
0
    void generateFindMethodAndArgs(Method method, IndentedWriter iw) throws IOException {
      iw.println("Class[] argTypes = ");
      iw.println("{");
      iw.upIndent();

      Class[] argTypes = method.getParameterTypes();
      for (int i = 0, len = argTypes.length; i < len; ++i) {
        if (i != 0) iw.println(",");
        iw.print(CodegenUtils.simpleClassName(argTypes[i]) + ".class");
      }
      iw.println();
      iw.downIndent();
      iw.println("};");
      iw.println(
          "Method method = Connection.class.getMethod( \042"
              + method.getName()
              + "\042 , argTypes );");
      iw.println();
      iw.println("Object[] args = ");
      iw.println("{");
      iw.upIndent();

      for (int i = 0, len = argTypes.length; i < len; ++i) {
        if (i != 0) iw.println(",");
        String argName = CodegenUtils.generatedArgumentName(i);
        Class argType = argTypes[i];
        if (argType.isPrimitive()) {
          if (argType == boolean.class) iw.print("Boolean.valueOf( " + argName + " )");
          else if (argType == byte.class) iw.print("new Byte( " + argName + " )");
          else if (argType == char.class) iw.print("new Character( " + argName + " )");
          else if (argType == short.class) iw.print("new Short( " + argName + " )");
          else if (argType == int.class) iw.print("new Integer( " + argName + " )");
          else if (argType == long.class) iw.print("new Long( " + argName + " )");
          else if (argType == float.class) iw.print("new Float( " + argName + " )");
          else if (argType == double.class) iw.print("new Double( " + argName + " )");
        } else iw.print(argName);
      }

      iw.downIndent();
      iw.println("};");
    }
Exemple #11
0
  void generateTryCloserAndCatch(Class intfcl, String genclass, Method method, IndentedWriter iw)
      throws IOException {
    iw.downIndent();
    iw.println("}");
    iw.println("catch (NullPointerException exc)");
    iw.println("{");
    iw.upIndent();
    iw.println("if ( this.isDetached() )");
    iw.println("{");
    iw.upIndent();
    // iw.println( "System.err.print(\042probably 'cuz we're closed -- \042);" );
    // iw.println( "exc.printStackTrace();" );
    if ("close".equals(method.getName())) {
      iw.println("if (Debug.DEBUG && logger.isLoggable( MLevel.FINE ))");
      iw.println("{");
      iw.upIndent();
      iw.println("logger.log( MLevel.FINE, this + \042: close() called more than once.\042 );");

      // premature-detach-debug-debug only!
      if (PREMATURE_DETACH_DEBUG) {
        iw.println("prematureDetachRecorder.record();");
        iw.println(
            "logger.warning( prematureDetachRecorder.getDump(\042Apparent multiple close of "
                + getInnerTypeName()
                + ".\042) );");
      }
      // end-premature-detach-debug-only!

      iw.downIndent();
      iw.println("}");
    } else {
      // premature-detach-debug-debug only!
      if (PREMATURE_DETACH_DEBUG) {
        iw.println("prematureDetachRecorder.record();");
        iw.println(
            "logger.warning( prematureDetachRecorder.getDump(\042Use of already detached "
                + getInnerTypeName()
                + ".\042) );");
      }
      // end-premature-detach-debug-only!

      iw.println(
          "throw SqlUtils.toSQLException(\042You can't operate on a closed "
              + getInnerTypeName()
              + "!!!\042, exc);");
    }
    iw.downIndent();
    iw.println("}");
    iw.println("else throw exc;");
    iw.downIndent();
    iw.println("}");
    iw.println("catch (Exception exc)");
    iw.println("{");
    iw.upIndent();
    iw.println("if (! this.isDetached())");
    iw.println("{");
    iw.upIndent();
    // iw.println( "exc.printStackTrace();" );
    iw.println("throw parentPooledConnection.handleThrowable( exc );");
    iw.downIndent();
    iw.println("}");
    iw.println("else throw SqlUtils.toSQLException( exc );");
    iw.downIndent();
    iw.println("}");
  }
Exemple #12
0
 protected void generatePostDelegateCode(
     Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException {
   if (!jdbc4WrapperMethod(method.getName()))
     generateTryCloserAndCatch(intfcl, genclass, method, iw);
 }
Exemple #13
0
 protected void generatePreDelegateCode(
     Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException {
   if (!jdbc4WrapperMethod(method.getName())) generateTryOpener(iw);
 }
Exemple #14
0
    protected void generateDelegateCode(
        Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException {
      String mname = method.getName();
      if (jdbc4WrapperMethod(mname)) {
        generateWrapperDelegateCode(intfcl, genclass, method, iw);
        return;
      }

      if (mname.equals("createStatement")) {
        iw.println("txn_known_resolved = false;");
        iw.println();
        iw.println("Statement innerStmt = inner." + CodegenUtils.methodCall(method) + ";");
        iw.println("parentPooledConnection.markActiveUncachedStatement( innerStmt );");
        iw.println(
            "return new NewProxyStatement( innerStmt, parentPooledConnection, false, this );");
      } else if (mname.equals("prepareStatement")) {
        iw.println("txn_known_resolved = false;");
        iw.println();
        iw.println("PreparedStatement innerStmt;");
        iw.println();
        iw.println("if ( parentPooledConnection.isStatementCaching() )");
        iw.println("{");
        iw.upIndent();

        iw.println("try");
        iw.println("{");
        iw.upIndent();

        generateFindMethodAndArgs(method, iw);
        iw.println(
            "innerStmt = (PreparedStatement) parentPooledConnection.checkoutStatement( method, args );");
        iw.println(
            "return new NewProxyPreparedStatement( innerStmt, parentPooledConnection, true, this );");

        iw.downIndent();
        iw.println("}");
        iw.println("catch (ResourceClosedException e)");
        iw.println("{");
        iw.upIndent();

        iw.println("if ( logger.isLoggable( MLevel.FINE ) )");
        iw.upIndent();
        iw.println(
            "logger.log( MLevel.FINE, "
                + "\042A Connection tried to prepare a Statement via a Statement cache that is already closed. "
                + "This can happen -- rarely -- if a DataSource is closed or reset() while Connections are checked-out and in use.\042, e );");
        iw.downIndent();

        // repeated code... any changes probably need to be duplicated below
        iw.println("innerStmt = inner." + CodegenUtils.methodCall(method) + ";");
        iw.println("parentPooledConnection.markActiveUncachedStatement( innerStmt );");
        iw.println(
            "return new NewProxyPreparedStatement( innerStmt, parentPooledConnection, false, this );");

        iw.downIndent();
        iw.println("}");

        iw.downIndent();
        iw.println("}");
        iw.println("else");
        iw.println("{");
        iw.upIndent();

        // repeated code... any changes probably need to be duplicated above
        iw.println("innerStmt = inner." + CodegenUtils.methodCall(method) + ";");
        iw.println("parentPooledConnection.markActiveUncachedStatement( innerStmt );");
        iw.println(
            "return new NewProxyPreparedStatement( innerStmt, parentPooledConnection, false, this );");

        iw.downIndent();
        iw.println("}");

      } else if (mname.equals("prepareCall")) {
        iw.println("txn_known_resolved = false;");
        iw.println();
        iw.println("CallableStatement innerStmt;");
        iw.println();
        iw.println("if ( parentPooledConnection.isStatementCaching() )");
        iw.println("{");
        iw.upIndent();

        iw.println("try");
        iw.println("{");
        iw.upIndent();

        generateFindMethodAndArgs(method, iw);
        iw.println(
            "innerStmt = (CallableStatement) parentPooledConnection.checkoutStatement( method, args );");
        iw.println(
            "return new NewProxyCallableStatement( innerStmt, parentPooledConnection, true, this );");

        iw.downIndent();
        iw.println("}");
        iw.println("catch (ResourceClosedException e)");
        iw.println("{");
        iw.upIndent();

        iw.println("if ( logger.isLoggable( MLevel.FINE ) )");
        iw.upIndent();
        iw.println(
            "logger.log( MLevel.FINE, "
                + "\042A Connection tried to prepare a CallableStatement via a Statement cache that is already closed. "
                + "This can happen -- rarely -- if a DataSource is closed or reset() while Connections are checked-out and in use.\042, e );");
        iw.downIndent();

        // repeated code... any changes probably need to be duplicated below
        iw.println("innerStmt = inner." + CodegenUtils.methodCall(method) + ";");
        iw.println("parentPooledConnection.markActiveUncachedStatement( innerStmt );");
        iw.println(
            "return new NewProxyCallableStatement( innerStmt, parentPooledConnection, false, this );");

        iw.downIndent();
        iw.println("}");

        iw.downIndent();
        iw.println("}");
        iw.println("else");
        iw.println("{");
        iw.upIndent();

        // repeated code... any changes probably need to be duplicated above
        iw.println("innerStmt = inner." + CodegenUtils.methodCall(method) + ";");
        iw.println("parentPooledConnection.markActiveUncachedStatement( innerStmt );");
        iw.println(
            "return new NewProxyCallableStatement( innerStmt, parentPooledConnection, false, this );");

        iw.downIndent();
        iw.println("}");

      } else if (mname.equals("getMetaData")) {
        iw.println("txn_known_resolved = false;");
        iw.println();
        iw.println("if (this.metaData == null)");
        iw.println("{");
        iw.upIndent();
        iw.println(
            "DatabaseMetaData innerMetaData = inner." + CodegenUtils.methodCall(method) + ";");
        iw.println(
            "this.metaData = new NewProxyDatabaseMetaData( innerMetaData, parentPooledConnection, this );");
        iw.downIndent();
        iw.println("}");
        iw.println("return this.metaData;");
      } else if (mname.equals("setTransactionIsolation")) {
        // do nothing with txn_known_resolved

        super.generateDelegateCode(intfcl, genclass, method, iw);
        iw.println(
            "parentPooledConnection.markNewTxnIsolation( "
                + CodegenUtils.generatedArgumentName(0)
                + " );");
      } else if (mname.equals("setCatalog")) {
        // do nothing with txn_known_resolved

        super.generateDelegateCode(intfcl, genclass, method, iw);
        iw.println(
            "parentPooledConnection.markNewCatalog( "
                + CodegenUtils.generatedArgumentName(0)
                + " );");
      } else if (mname.equals("setHoldability")) {
        // do nothing with txn_known_resolved

        super.generateDelegateCode(intfcl, genclass, method, iw);
        iw.println(
            "parentPooledConnection.markNewHoldability( "
                + CodegenUtils.generatedArgumentName(0)
                + " );");
      } else if (mname.equals("setReadOnly")) {
        // do nothing with txn_known_resolved

        super.generateDelegateCode(intfcl, genclass, method, iw);
        iw.println(
            "parentPooledConnection.markNewReadOnly( "
                + CodegenUtils.generatedArgumentName(0)
                + " );");
      } else if (mname.equals("setTypeMap")) {
        // do nothing with txn_known_resolved

        super.generateDelegateCode(intfcl, genclass, method, iw);
        iw.println(
            "parentPooledConnection.markNewTypeMap( "
                + CodegenUtils.generatedArgumentName(0)
                + " );");
      } else if (mname.equals("getWarnings") || mname.equals("clearWarnings")) {
        // do nothing with txn_known_resolved

        super.generateDelegateCode(intfcl, genclass, method, iw);
      } else if (mname.equals("close")) {
        iw.println("if (! this.isDetached())");
        iw.println("{");
        iw.upIndent();
        iw.println("NewPooledConnection npc = parentPooledConnection;");
        iw.println("this.detach();");
        iw.println("npc.markClosedProxyConnection( this, txn_known_resolved );");
        iw.println("this.inner = null;");
        iw.downIndent();
        iw.println("}");
        iw.println("else if (Debug.DEBUG && logger.isLoggable( MLevel.FINE ))");
        iw.println("{");
        iw.upIndent();
        iw.println("logger.log( MLevel.FINE, this + \042: close() called more than once.\042 );");

        // premature-detach-debug-debug only!
        if (PREMATURE_DETACH_DEBUG) {
          iw.println("prematureDetachRecorder.record();");
          iw.println(
              "logger.warning( prematureDetachRecorder.getDump(\042Apparent multiple close of "
                  + getInnerTypeName()
                  + ".\042) );");
        }
        // end-premature-detach-debug-only!

        iw.downIndent();
        iw.println("}");
      } else if (mname.equals("isClosed")) {
        iw.println("return this.isDetached();");
      } else if (mname.equals("isValid")) {
        iw.println("if (this.isDetached()) return false;");

        super.generateDelegateCode(intfcl, genclass, method, iw);
      } else {
        boolean known_resolved =
            (mname.equals("commit") || mname.equals("rollback") || mname.equals("setAutoCommit"));

        if (!known_resolved) {
          iw.println("txn_known_resolved = false;");
          iw.println();
        }
        super.generateDelegateCode(intfcl, genclass, method, iw);
        if (known_resolved) {
          iw.println();
          iw.println("txn_known_resolved = true;");
        }
      }
    }
Exemple #15
0
    protected void generateDelegateCode(
        Class intfcl, String genclass, Method method, IndentedWriter iw) throws IOException {

      String mname = method.getName();
      if (jdbc4WrapperMethod(mname)) {
        generateWrapperDelegateCode(intfcl, genclass, method, iw);
        return;
      }

      Class retType = method.getReturnType();

      iw.println("maybeDirtyTransaction();");
      iw.println();

      if (ResultSet.class.isAssignableFrom(retType)) {
        iw.println("ResultSet innerResultSet = inner." + CodegenUtils.methodCall(method) + ";");
        iw.println("if (innerResultSet == null) return null;");
        iw.println(
            "parentPooledConnection.markActiveResultSetForStatement( inner, innerResultSet );");
        iw.println(
            "NewProxyResultSet out = new NewProxyResultSet( innerResultSet, parentPooledConnection, inner, this );");
        iw.println("synchronized ( myProxyResultSets ) { myProxyResultSets.add( out ); }");
        iw.println("return out;");
      } else if (mname.equals("getConnection")) {
        iw.println("if (! this.isDetached())");
        iw.upIndent();
        iw.println("return creatorProxy;");
        iw.downIndent();
        iw.println("else");
        iw.upIndent();
        iw.println("throw new SQLException(\"You cannot operate on a closed Statement!\");");
        iw.downIndent();
      } else if (mname.equals("close")) {
        iw.println("if (! this.isDetached())");
        iw.println("{");
        iw.upIndent();
        // iw.println("System.err.println(\042Closing proxy Statement: \042 + this);");
        iw.println("synchronized ( myProxyResultSets )");
        iw.println("{");
        iw.upIndent();
        iw.println("for( Iterator ii = myProxyResultSets.iterator(); ii.hasNext(); )");
        iw.println("{");
        iw.upIndent();
        iw.println("ResultSet closeMe = (ResultSet) ii.next();");
        iw.println("ii.remove();");
        iw.println();
        iw.println("try { closeMe.close(); }");
        iw.println("catch (SQLException e)");
        iw.println("{");
        iw.upIndent();
        iw.println("if (logger.isLoggable( MLevel.WARNING ))");
        iw.upIndent();
        iw.println(
            "logger.log( MLevel.WARNING, \042Exception on close of apparently orphaned ResultSet.\042, e);");
        iw.downIndent();
        iw.downIndent();
        iw.println("}");
        iw.println("if (logger.isLoggable( MLevel.FINE ))");
        iw.upIndent();
        iw.println(
            "logger.log( MLevel.FINE, this + \042 closed orphaned ResultSet: \042 +closeMe);");
        iw.downIndent();
        iw.downIndent();
        iw.println("}");
        iw.downIndent();
        iw.println("}");
        iw.println();
        iw.println("if ( is_cached )");
        iw.upIndent();
        iw.println("parentPooledConnection.checkinStatement( inner );");
        iw.downIndent();
        iw.println("else");
        iw.println("{");
        iw.upIndent();
        iw.println("parentPooledConnection.markInactiveUncachedStatement( inner );");

        iw.println("try{ inner.close(); }");
        iw.println("catch (Exception e )");
        iw.println("{");
        iw.upIndent();

        iw.println("if (logger.isLoggable( MLevel.WARNING ))");
        iw.upIndent();
        iw.println(
            "logger.log( MLevel.WARNING, \042Exception on close of inner statement.\042, e);");
        iw.downIndent();

        iw.println("SQLException sqle = SqlUtils.toSQLException( e );");
        iw.println("throw sqle;");
        iw.downIndent();
        iw.println("}");
        iw.downIndent();
        iw.println("}");

        iw.println();
        iw.println("this.detach();");
        iw.println("this.inner = null;");
        iw.println("this.creatorProxy = null;");

        iw.downIndent();
        iw.println("}");
      } else if (mname.equals("isClosed")) {
        iw.println("return this.isDetached();");
      } else super.generateDelegateCode(intfcl, genclass, method, iw);
    }
    public synchronized Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
      if (OBJECT_METHODS.contains(m)) return m.invoke(this, args);

      try {
        String mname = m.getName();
        if (activeConnection != null) {
          if (mname.equals("rawConnectionOperation")) {
            ensureOkay();
            txn_known_resolved = false;

            return doRawConnectionOperation((Method) args[0], args[1], (Object[]) args[2]);
          } else if (mname.equals("setTransactionIsolation")) {
            ensureOkay();

            // don't modify txn_known_resolved

            m.invoke(activeConnection, args);

            int lvl = ((Integer) args[0]).intValue();
            isolation_lvl_nondefault = (lvl != dflt_txn_isolation);

            // System.err.println("updated txn isolation to " + lvl + ", nondefault level? " +
            // isolation_lvl_nondefault);

            return null;
          } else if (mname.equals("setCatalog")) {
            ensureOkay();

            // don't modify txn_known_resolved

            m.invoke(activeConnection, args);

            String catalog = (String) args[0];
            catalog_nondefault = ObjectUtils.eqOrBothNull(catalog, dflt_catalog);

            return null;
          } else if (mname.equals("setHoldability")) {
            ensureOkay();

            // don't modify txn_known_resolved

            m.invoke(
                activeConnection,
                args); // will throw an exception if setHoldability() not supported...

            int holdability = ((Integer) args[0]).intValue();
            holdability_nondefault = (holdability != dflt_holdability);

            return null;
          } else if (mname.equals("createStatement")) {
            ensureOkay();
            txn_known_resolved = false;

            Object stmt = m.invoke(activeConnection, args);
            return createProxyStatement((Statement) stmt);
          } else if (mname.equals("prepareStatement")) {
            ensureOkay();
            txn_known_resolved = false;

            Object pstmt;
            if (scache == null) {
              pstmt = m.invoke(activeConnection, args);
              return createProxyStatement((Statement) pstmt);
            } else {
              pstmt = scache.checkoutStatement(physicalConnection, m, args);
              return createProxyStatement(true, (Statement) pstmt);
            }
          } else if (mname.equals("prepareCall")) {
            ensureOkay();
            txn_known_resolved = false;

            Object cstmt;
            if (scache == null) {
              cstmt = m.invoke(activeConnection, args);
              return createProxyStatement((Statement) cstmt);
            } else {
              cstmt = scache.checkoutStatement(physicalConnection, m, args);
              return createProxyStatement(true, (Statement) cstmt);
            }
          } else if (mname.equals("getMetaData")) {
            ensureOkay();
            txn_known_resolved = false; // views of tables etc. might be txn dependent

            DatabaseMetaData innerMd = activeConnection.getMetaData();
            if (metaData == null) {
              // exposedProxy is protected by C3P0PooledConnection.this' lock
              synchronized (C3P0PooledConnection.this) {
                metaData =
                    new SetManagedDatabaseMetaData(innerMd, activeMetaDataResultSets, exposedProxy);
              }
            }
            return metaData;
          } else if (mname.equals("silentClose")) {
            // the PooledConnection doesn't have to be okay

            doSilentClose(proxy, ((Boolean) args[0]).booleanValue(), this.txn_known_resolved);
            return null;
          } else if (mname.equals("close")) {
            // the PooledConnection doesn't have to be okay

            Exception e = doSilentClose(proxy, false, this.txn_known_resolved);
            if (!connection_error_signaled) ces.fireConnectionClosed();
            // System.err.println("close() called on a ProxyConnection.");
            if (e != null) {
              // 					    System.err.print("user close exception -- ");
              // 					    e.printStackTrace();
              throw e;
            } else return null;
          }
          // 			    else if ( mname.equals("finalize") ) //REMOVE THIS CASE -- TMP DEBUG
          // 				{
          // 				    System.err.println("Connection apparently finalized!");
          // 				    return m.invoke( activeConnection, args );
          // 				}
          else {
            ensureOkay();

            // we've disabled setting txn_known_resolved to true, ever, because
            // we failed to deal with the case that clients would work with previously
            // acquired Statements and ResultSets after a commit(), rollback(), or setAutoCommit().
            // the new non-reflective proxies have been modified to deal with this case.
            // here, with soon-to-be-deprecated in "traditional reflective proxies mode"
            // we are reverting to the conservative, always-presume-you-have-to-rollback
            // policy.

            // txn_known_resolved = ( mname.equals("commit") || mname.equals( "rollback" ) ||
            // mname.equals( "setAutoCommit" ) );
            txn_known_resolved = false;

            return m.invoke(activeConnection, args);
          }
        } else {
          if (mname.equals("close") || mname.equals("silentClose")) return null;
          else if (mname.equals("isClosed")) return Boolean.TRUE;
          else {
            throw new SQLException("You can't operate on " + "a closed connection!!!");
          }
        }
      } catch (InvocationTargetException e) {
        Throwable convertMe = e.getTargetException();
        SQLException sqle = handleMaybeFatalToPooledConnection(convertMe, proxy, false);
        sqle.fillInStackTrace();
        throw sqle;
      }
    }