/** * 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(); } }
/** * My {@link KeyedPoolableObjectFactory} method for passivating {@link PreparedStatement}s. * Currently invokes {@link PreparedStatement#clearParameters}. * * @param key ignored * @param obj a {@link PreparedStatement} */ public void passivateObject(Object key, Object obj) throws Exception { ((PreparedStatement) obj).clearParameters(); ((DelegatingPreparedStatement) obj).passivate(); }
/** * My {@link KeyedPoolableObjectFactory} method for activating {@link PreparedStatement}s. * (Currently a no-op.) * * @param key ignored * @param obj ignored */ public void activateObject(Object key, Object obj) { ((DelegatingPreparedStatement) obj).activate(); }