/** * Destroy the object, ignoring the key. * * @param key ignored * @param obj instance to destroy */ public void destroyObject(final K key, final V obj) throws Exception { factory.destroyObject(obj); }
/** * {@inheritDoc} */ public void destroyObject(final T obj) throws Exception { synchronized (lock) { factory.destroyObject(obj); } }
/** * {@inheritDoc} */ @Override public synchronized void invalidateObject(T obj) throws Exception { _numActive--; if (_factory != null) { _factory.destroyObject(obj); } notifyAll(); // _numActive has changed }
/** * {@inheritDoc} */ @Override public synchronized void invalidateObject(T obj) throws Exception { _numActive--; if (null != _factory) { _factory.destroyObject(obj); } notifyAll(); // _numActive has changed }
/** * Clears any objects sitting idle in the pool. */ @Override public synchronized void clear() { if(null != _factory) { Iterator<SoftReference<T>> iter = _pool.iterator(); while(iter.hasNext()) { try { T obj = iter.next().get(); if(null != obj) { _factory.destroyObject(obj); } } catch(Exception e) { // ignore error, keep destroying the rest } } } _pool.clear(); pruneClearedReferences(); }
/** * Clears any objects sitting idle in the pool. Silently swallows any * exceptions thrown by {@link PoolableObjectFactory#destroyObject(Object)}. */ @Override public synchronized void clear() { if(null != _factory) { Iterator<T> it = _pool.iterator(); while(it.hasNext()) { try { _factory.destroyObject(it.next()); } catch(Exception e) { // ignore error, keep destroying the rest } } } _pool.clear(); }
/** * {@inheritDoc} * <p>Activation of this method decrements the active count and attempts to destroy the instance.</p> * * @throws Exception if the configured {@link PoolableObjectFactory} throws an exception destroying obj */ @Override public void invalidateObject(T obj) throws Exception { try { if (_factory != null) { _factory.destroyObject(obj); } } finally { synchronized (this) { _numActive--; } allocate(); } }
/** * Private method to destroy all the objects in a collection using the * supplied object factory. Assumes that objects in the collection are * instances of ObjectTimestampPair and that the object instances that * they wrap were created by the factory. * * @param c Collection of objects to destroy * @param factory PoolableConnectionFactory used to destroy the objects */ private void destroy(Collection<ObjectTimestampPair<T>> c, PoolableObjectFactory<T> factory) { for (Iterator<ObjectTimestampPair<T>> it = c.iterator(); it.hasNext();) { try { factory.destroyObject(it.next().value); } catch(Exception e) { // ignore error, keep destroying the rest } finally { synchronized(this) { _numInternalProcessing--; } allocate(); } } }
_factory.destroyObject(obj); } catch(Exception e) {
_factory.destroyObject(obj); } catch(Exception e) {
if (_factory != null) { try { _factory.destroyObject(obj); } catch (Exception e2) {
_factory.destroyObject(obj); } catch(Exception e) {
_factory.destroyObject(obj); } catch(Exception e) {
/** * Create an object, and place it into the pool. * addObject() is useful for "pre-loading" a pool with idle objects. */ @Override public void addObject() throws Exception { assertOpen(); if (_factory == null) { throw new IllegalStateException("Cannot add objects without a factory."); } T obj = _factory.makeObject(); try { assertOpen(); addObjectToPool(obj, false); } catch (IllegalStateException ex) { // Pool closed try { _factory.destroyObject(obj); } catch (Exception ex2) { // swallow } throw ex; } }
PoolUtils.checkRethrow(t); try { _factory.destroyObject(obj); } catch (Throwable t2) { PoolUtils.checkRethrow(t2);
PoolUtils.checkRethrow(t); try { _factory.destroyObject(obj); } catch (Throwable t2) { PoolUtils.checkRethrow(t2);
_factory.destroyObject(latch.getPair().value); } catch (Throwable e2) { PoolUtils.checkRethrow(e2);
_factory.destroyObject(obj); } catch(Exception e) {
_factory.destroyObject(pair.value); } catch(Exception e) {
/** * {@inheritDoc} */ @Override public synchronized void invalidateObject(T obj) throws Exception { _numActive--; if (null != _factory) { _factory.destroyObject(obj); } notifyAll(); // _numActive has changed }