示例#1
0
 synchronized void closeMaybeCheckedOut(boolean checked_out) throws SQLException {
   if (checked_out) {
     // reset transaction state
     try {
       C3P0ImplUtils.resetTxnState(
           physicalConnection, forceIgnoreUnresolvedTransactions, autoCommitOnClose, false);
     } catch (Exception e) {
       if (logger.isLoggable(MLevel.FINER))
         logger.log(
             MLevel.FINER,
             "Failed to reset the transaction state of  "
                 + physicalConnection
                 + "just prior to close(). "
                 + "Only relevant at all if this was a Connection being forced close()ed midtransaction.",
             e);
     }
   }
   close(false);
 }
示例#2
0
  private void reset(boolean known_resolved_txn) throws SQLException {
    ensureOkay();
    C3P0ImplUtils.resetTxnState(
        physicalConnection,
        forceIgnoreUnresolvedTransactions,
        autoCommitOnClose,
        known_resolved_txn);
    if (isolation_lvl_nondefault) {
      physicalConnection.setTransactionIsolation(dflt_txn_isolation);
      isolation_lvl_nondefault = false;
    }
    if (catalog_nondefault) {
      physicalConnection.setCatalog(dflt_catalog);
      catalog_nondefault = false;
    }
    if (holdability_nondefault) // we don't test if holdability is supported, 'cuz it can never go
                                // nondefault if it's not.
    {
      physicalConnection.setHoldability(dflt_holdability);
      holdability_nondefault = false;
    }

    try {
      physicalConnection.setReadOnly(false);
    } catch (Throwable t) {
      if (logger.isLoggable(MLevel.FINE))
        logger.log(
            MLevel.FINE,
            "A Throwable occurred while trying to reset the readOnly property of our Connection to false!",
            t);
    }

    try {
      if (supports_setTypeMap) physicalConnection.setTypeMap(Collections.EMPTY_MAP);
    } catch (Throwable t) {
      if (logger.isLoggable(MLevel.FINE))
        logger.log(
            MLevel.FINE,
            "A Throwable occurred while trying to reset the typeMap property of our Connection to Collections.EMPTY_MAP!",
            t);
    }
  }