/** * {@inheritDoc} */ public void shutdown() { if (log.isTraceEnabled()) log.tracef("Shutdown - Pool: %s MCP: %s", pool.getName(), Integer.toHexString(System.identityHashCode(this))); IdleRemover.getInstance().unregisterPool(this); ConnectionValidator.getInstance().unregisterPool(this); if (checkedOutSize.get() > 0) { for (Entry<ConnectionListener, ConnectionListenerWrapper> entry : cls.entrySet()) { if (entry.getValue().isCheckedOut()) log.destroyingActiveConnection(pool.getName(), entry.getKey().getManagedConnection()); if (Tracer.isEnabled()) Tracer.clearConnectionListener(pool.getName(), this, entry.getKey()); } } final Collection<ConnectionListener> toDestroy = new ArrayList<ConnectionListener>(); flush(FlushMode.ALL, toDestroy); for (ConnectionListener cl : toDestroy) { cl.destroy(); } }
/** * {@inheritDoc} */ public void shutdown() { final Collection<ConnectionListener> toDestroy; synchronized (this) { if (log.isTraceEnabled()) log.tracef("Shutdown - Pool: %s MCP: %s", pool.getName(), Integer.toHexString(System.identityHashCode( this))); IdleRemover.getInstance().unregisterPool(this); ConnectionValidator.getInstance().unregisterPool(this); if (checkedOut.size() > 0) { for (ConnectionListener cl : checkedOut) { log.destroyingActiveConnection(pool.getName(), cl.getManagedConnection()); if (Tracer.isEnabled()) Tracer.clearConnectionListener(pool.getName(), this, cl); } } toDestroy = new ArrayList<ConnectionListener>(); flush(FlushMode.ALL, toDestroy); } for (ConnectionListener cl : toDestroy) { cl.destroy(); } }