/** * Remove (close) any unused sessions in the pool. */ @Override public void destroy() { this.pool.removeAllIdleItems(); }
@Override public synchronized void stop() { this.targetConnectionFactory.stop(); this.pool.removeAllIdleItems(); }
/** * Clear the cache of sessions; also any in-use sessions will be closed when * returned to the cache. */ public synchronized void resetCache() { if (logger.isDebugEnabled()) { logger.debug("Cache reset; idle sessions will be removed, in-use sessions will be closed when returned"); } if (this.isSharedSessionCapable && ((SharedSessionCapable) this.sessionFactory).isSharedSession()) { ((SharedSessionCapable) this.sessionFactory).resetSharedSession(); } long epoch = System.nanoTime(); /* * Spin until we get a new value - nano precision but may be lower resolution. * We reset the epoch AFTER resetting the shared session so there is no possibility * of an "old" session being created in the new epoch. There is a slight possibility * that a "new" session might appear in the old epoch and thus be closed when returned to * the cache. */ while (epoch == this.sharedSessionEpoch) { epoch = System.nanoTime(); } this.sharedSessionEpoch = epoch; this.pool.removeAllIdleItems(); }
@Override public synchronized void stop() { this.targetConnectionFactory.stop(); this.pool.removeAllIdleItems(); }