/** * Destroy the object, passing the fixed key to the factory. * * @param obj object to destroy */ public void destroyObject(final V obj) throws Exception { keyedFactory.destroyObject(key, obj); }
/** * {@inheritDoc} */ public void destroyObject(final K key, final V obj) throws Exception { synchronized (lock) { keyedFactory.destroyObject(key, obj); } }
/** * {@inheritDoc} */ @Override public synchronized void invalidateObject(K key, V obj) throws Exception { decrementActiveCount(key); if(null != _factory) { _factory.destroyObject(key,obj); } notifyAll(); // _totalActive has changed }
/** * Destroys all instances in the stack and clears the stack. * * @param key key passed to factory when destroying instances * @param stack stack to destroy */ private synchronized void destroyStack(K key, Stack<V> stack) { if(null == stack) { return; } else { if(null != _factory) { Iterator<V> it = stack.iterator(); while(it.hasNext()) { try { _factory.destroyObject(key,it.next()); } catch(Exception e) { // ignore error, keep destroying the rest } } } _totIdle -= stack.size(); _activeCount.remove(key); stack.clear(); } }
for (Iterator<ObjectTimestampPair<V>> it = c.iterator(); it.hasNext();) { try { factory.destroyObject( key,it.next().value); } catch(Exception e) {
_factory.passivateObject(key, obj); } catch (Exception ex) { _factory.destroyObject(key, obj); return; if (null != _factory) { try { _factory.destroyObject(key, obj); } catch (Exception e) { _factory.destroyObject(key, staleObj); } catch (Exception e) {
_factory.destroyObject(key, obj); } catch (Exception e2) { _factory.destroyObject(key, staleObj); } catch (Exception e) {
/** * {@inheritDoc} * <p>Activation of this method decrements the active count associated with the given keyed pool * and attempts to destroy <code>obj.</code></p> * * @param key pool key * @param obj instance to invalidate * @throws Exception if an exception occurs destroying the object */ @Override public void invalidateObject(K key, V obj) throws Exception { try { _factory.destroyObject(key, obj); } finally { synchronized (this) { ObjectQueue pool = (_poolMap.get(key)); if (null == pool) { pool = new ObjectQueue(); _poolMap.put(key, pool); _poolList.add(key); } pool.decrementActiveCount(); } allocate(); // _totalActive has changed } }
PoolUtils.checkRethrow(t); try { _factory.destroyObject(key,obj); } catch (Throwable t2) { PoolUtils.checkRethrow(t2);
/** * Create an object using the {@link KeyedPoolableObjectFactory#makeObject factory}, * passivate it, and then place it in the idle object pool. * <code>addObject</code> is useful for "pre-loading" a pool with idle objects. * * @param key the key a new instance should be added to * @throws Exception when {@link KeyedPoolableObjectFactory#makeObject} fails. * @throws IllegalStateException when no {@link #setFactory factory} has been set or after {@link #close} has been * called on this pool. */ @Override public void addObject(K key) throws Exception { assertOpen(); if (_factory == null) { throw new IllegalStateException("Cannot add objects without a factory."); } V obj = _factory.makeObject(key); try { assertOpen(); addObjectToPool(key, obj, false); } catch (IllegalStateException ex) { // Pool closed try { _factory.destroyObject(key, obj); } catch (Exception ex2) { // swallow } throw ex; } }
if (_factory != null) { try { _factory.destroyObject(key, obj); } catch (Exception e2) {
_factory.destroyObject(key, latch.getPair().value); } catch (Throwable e2) { PoolUtils.checkRethrow(e2);
_factory.destroyObject(key, obj); } catch(Exception e) {
_factory.destroyObject(key, pair.value); } catch(Exception e) {
/** * Destroy the object, passing the fixed key to the factory. * * @param obj object to destroy */ public void destroyObject(final V obj) throws Exception { keyedFactory.destroyObject(key, obj); }
/** * {@inheritDoc} */ public void destroyObject(final K key, final V obj) throws Exception { synchronized (lock) { keyedFactory.destroyObject(key, obj); } }
/** * {@inheritDoc} */ public void destroyObject(final K key, final V obj) throws Exception { synchronized (lock) { keyedFactory.destroyObject(key, obj); } }
public void destroyObject(final Object key, final Object obj) throws Exception { synchronized (lock) { keyedFactory.destroyObject(key, obj); } }
/** * {@inheritDoc} */ @Override public synchronized void invalidateObject(K key, V obj) throws Exception { decrementActiveCount(key); if(null != _factory) { _factory.destroyObject(key,obj); } notifyAll(); // _totalActive has changed }
public synchronized void invalidateObject(Object key, Object obj) throws Exception { decrementActiveCount(key); if(null != _factory) { _factory.destroyObject(key,obj); } notifyAll(); // _totalActive has changed }