/** * Flushes the open {@link Statement} cache for this connection. * @throws SQLException if thrown while attempting to flush statements */ protected void flushOpenStatements() throws SQLException { synchronized(ssUsed) { int count = ssUsed.size(); if (count > 0) { log_debug(pool.getName() + ": Closing " + count + " open Statement" + (count != 1 ? "s" : "")); while (!ssUsed.isEmpty()) (ssUsed.remove(0)).release(); } } }
/** * Flushes the open {@link CallableStatement} cache for this connection. * @throws SQLException if thrown while attempting to flush statements */ protected void flushOpenCallableStatements() throws SQLException { synchronized(csUsed) { int count = csUsed.size(); if (count > 0) { log_debug(pool.getName() + ": Closing " + count + " open CallableStatement" + (count != 1 ? "s" : "")); while (!csUsed.isEmpty()) (csUsed.remove(0)).release(); } } }
/** * Flushes the spare {@link Statement} caches for this connection. * @throws SQLException if thrown while attempting to flush statements */ protected void flushSpareStatements() throws SQLException { synchronized(ss) { int count = ss.size(); if (count > 0) { log_debug(pool.getName() + ": Closing " + count + " cached Statement" + (count != 1 ? "s" : "")); while (!ss.isEmpty()) (ss.remove(0)).release(); } } }
/** * 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 CallableStatement} cache for this connection. * @throws SQLException if thrown while attempting to flush statements */ protected void flushSpareCallableStatements() throws SQLException { synchronized(cs) { int count = cs.size(); if (count > 0) { log_debug(pool.getName() + ": Closing " + count + " cached CallableStatement" + (count != 1 ? "s" : "")); for (List<CachedCallableStatement> list : cs.values()) { for (CachedCallableStatement ccs : list) ccs.release(); } cs.clear(); } } }
/** * 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(); } } }
/** * Flushes the non-cacheable {@link Statement} instances for this connection. * @throws SQLException if thrown while attempting to flush statements */ protected void flushOpenNonCacheableStatements() throws SQLException { synchronized(nonCacheable) { int count = nonCacheable.size(); if (count > 0) { log_debug(pool.getName() + ": Closing " + count + " open non-cacheable Statement" + (count != 1 ? "s" : "")); while (!nonCacheable.isEmpty()) { try { ((Statement)nonCacheable.remove(0)).close(); } catch (SQLException sqlx) { logger.warn(pool.getName() + ": " + sqlx.getMessage(), sqlx); } } } } }
if (count > 0) log_debug(pool.getName() + ": Cleaning " + count + " cached Statement" + (count != 1 ? "s" : "")); synchronized(ssUsed) if (count > 0) log_debug(pool.getName() + ": Cleaning " + count + " cached PreparedStatement" + (count != 1 ? "s" : "")); synchronized(psUsed) if (count > 0) log_debug(pool.getName() + ": Cleaning " + count + " cached CallableStatement" + (count != 1 ? "s" : "")); synchronized(csUsed)
log_debug(pool.getName() + ": CallableStatement cache hit [" + sql + "," + ccs.getParametersString() + "] - " + showHitRate(csHit, csReq, "CS-")); ccs.setStatementListener(this); ccs.setOpen(); log_debug(pool.getName() + ": CallableStatement cache miss [" + sql + "," + ccs.getParametersString() + "] - " + showHitRate(csHit, csReq, "CS-"));
log_debug(pool.getName() + ": PreparedStatement cache hit [" + sql + "," + cps.getParametersString() + "] - " + showHitRate(psHit, psReq, "PS-")); cps.setStatementListener(this); cps.setOpen(); log_debug(pool.getName() + ": PreparedStatement cache miss [" + sql + "," + cps.getParametersString() + "] - " + showHitRate(psHit, psReq, "PS-"));