public synchronized void close() { resetPoolManager(); is_closed = true; C3P0Registry.markClosed(this); if (Debug.DEBUG && Debug.TRACE == Debug.TRACE_MAX && logger.isLoggable(MLevel.FINEST)) { logger.log( MLevel.FINEST, this.getClass().getName() + '@' + Integer.toHexString(System.identityHashCode(this)) + " has been closed. ", new Exception("DEBUG STACK TRACE for PoolBackedDataSource.close().")); } }
public static SQLException toSQLException(String msg, String sqlState, Throwable t) { if (t instanceof SQLException) { if (Debug.DEBUG && Debug.TRACE == Debug.TRACE_MAX && logger.isLoggable(MLevel.FINER)) { SQLException s = (SQLException) t; StringBuffer tmp = new StringBuffer(255); tmp.append("Attempted to convert SQLException to SQLException. Leaving it alone."); tmp.append(" [SQLState: "); tmp.append(s.getSQLState()); tmp.append("; errorCode: "); tmp.append(s.getErrorCode()); tmp.append(']'); if (msg != null) tmp.append(" Ignoring suggested message: '" + msg + "'."); logger.log(MLevel.FINER, tmp.toString(), t); SQLException s2 = s; while ((s2 = s2.getNextException()) != null) logger.log(MLevel.FINER, "Nested SQLException or SQLWarning: ", s2); } return (SQLException) t; } else { if (Debug.DEBUG) { // t.printStackTrace(); if (logger.isLoggable(MLevel.FINE)) logger.log(MLevel.FINE, "Converting Throwable to SQLException...", t); } if (msg == null) msg = "An SQLException was provoked by the following failure: " + t.toString(); if (VersionUtils.isAtLeastJavaVersion14()) { SQLException out = new SQLException(msg); out.initCause(t); return out; } else return new SQLException( msg + System.getProperty("line.separator") + "[Cause: " + ThrowableUtils.extractStackTrace(t) + ']', sqlState); } }