/** * Flushes the open {@link PreparedStatement} cache for this connection. * @throws SQLException if thrown while attempting to flush statements */ protected void flushOpenPreparedStatements() throws SQLException { synchronized(psUsed) { int count = psUsed.size(); if (count > 0) { log_debug(pool.getName() + ": Closing " + count + " open PreparedStatement" + (count != 1 ? "s" : "")); while (!psUsed.isEmpty()) (psUsed.remove(0)).release(); } } }
/** * Flushes the spare {@link PreparedStatement} cache for this connection. * @throws SQLException if thrown while attempting to flush statements */ protected void flushSparePreparedStatements() throws SQLException { synchronized(ps) { int count = ps.size(); if (count > 0) { log_debug(pool.getName() + ": Closing " + count + " cached PreparedStatement" + (count != 1 ? "s" : "")); for (List<CachedPreparedStatement> list : ps.values()) { for (CachedPreparedStatement cps : list) cps.release(); } ps.clear(); } } }