/** * Destroys a wrapped pooled object. * * @param toDestroy The wrapped pooled object to destroy * * @throws Exception If the factory fails to destroy the pooled object * cleanly */ private void destroy(final PooledObject<T> toDestroy) throws Exception { toDestroy.invalidate(); idleObjects.remove(toDestroy); allObjects.remove(new IdentityWrapper<>(toDestroy.getObject())); try { factory.destroyObject(toDestroy); } finally { destroyedCount.incrementAndGet(); createCount.decrementAndGet(); } }
toDestroy.invalidate();
@Override public void destroyObject(final PooledObject<MemcachedClientIF> p) { try { p.getObject().shutdown(); p.invalidate(); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } }
/** * Destroys a wrapped pooled object. * * @param toDestroy The wrapped pooled object to destroy * * @throws Exception If the factory fails to destroy the pooled object * cleanly */ private void destroy(final PooledObject<T> toDestroy) throws Exception { toDestroy.invalidate(); idleObjects.remove(toDestroy); allObjects.remove(new IdentityWrapper<>(toDestroy.getObject())); try { factory.destroyObject(toDestroy); } finally { destroyedCount.incrementAndGet(); createCount.decrementAndGet(); } }