// @Override public void checkForProperClosure() { for (StatementHandle statement : this.cache.values()) { if (!statement.isClosedOrEnqueuedForClosure()) { logger.error( statement.isClosed() + " " + statement.isEnqueuedForClosure() + "Statement not closed properly in application\n\n" + statement.getOpenStackTrace()); } } }
// @Override public void clear() { for (StatementHandle statement : this.cache.values()) { try { if (!(statement.isClosed() || statement .isEnqueuedForClosure())) { // this might race with statement release helper but // nothing bad should occur statement.close(); } } catch (SQLException e) { // don't log, we might fail if the connection link has died // logger.error("Error closing off statement", e); } } this.cache.clear(); }
// @Override public StatementHandle get(String key) { StatementHandle statement = this.cache.get(key); if (statement != null && (statement.isEnqueuedForClosure() || !statement.logicallyClosed.compareAndSet(true, false))) { statement = null; } if (this.maintainStats) { if (statement != null) { this.statistics.incrementCacheHits(); } else { this.statistics.incrementCacheMiss(); } } return statement; }