/** * My {@link KeyedPoolableObjectFactory} method for destroying {@link PreparedStatement}s. * * @param key ignored * @param obj the {@link PreparedStatement} to be destroyed. */ public void destroyObject(Object key, Object obj) throws Exception { // _openPstmts--; if (obj instanceof DelegatingPreparedStatement) { ((DelegatingPreparedStatement) obj).getInnermostDelegate().close(); } else { ((PreparedStatement) obj).close(); } }