/** * {@inheritDoc} */ @Override protected int numIdle(final K key) { return getKeyedPool().getNumIdle(key); }
/** * Returns the total number of instances currently idle in this pool (optional operation). * Returns a negative value if this information is not available. * * @param key ignored * @return the total number of instances currently idle in this pool or a negative value if unsupported * @throws UnsupportedOperationException <strong>deprecated</strong>: when this implementation doesn't support the operation */ protected int numIdle(final K key) { return getKeyedPool().getNumIdle(); }
/** * {@inheritDoc} */ public void returnObject(final T obj) { synchronized (lock) { try { pool.returnObject(obj); } catch (Exception e) { // swallowed as of Pool 2 } } }
@Override public void doOperation(int id) throws Exception { Integer key = id % numKeys; String s = (String) pool.borrowObject(key); pool.returnObject(key, s); } };
/** * {@inheritDoc} */ public void returnObject(final V obj) { try { keyedPool.returnObject(key, obj); } catch (Exception e) { // swallowed as of Pool 2 } }
/** * {@inheritDoc} */ public V borrowObject() throws Exception, NoSuchElementException, IllegalStateException { return keyedPool.borrowObject(key); }
/** * {@inheritDoc} */ public void invalidateObject(final K key, final V obj) { synchronized (lock) { try { keyedPool.invalidateObject(key, obj); } catch (Exception e) { // swallowed as of Pool 2 } } }
/** * {@inheritDoc} */ public void clear() throws Exception, UnsupportedOperationException { pool.clear(); }
/** * {@inheritDoc} */ public void close() { try { synchronized (lock) { keyedPool.close(); } } catch (Exception e) { // swallowed as of Pool 2 } }
/** * {@inheritDoc} */ public int getNumIdle() throws UnsupportedOperationException { return keyedPool.getNumIdle(key); }
/** * {@inheritDoc} */ public int getNumActive() throws UnsupportedOperationException { return keyedPool.getNumActive(key); }
/** * {@inheritDoc} */ public void clear() throws Exception, UnsupportedOperationException { keyedPool.clear(); }
/** * {@inheritDoc} */ public void addObject() throws Exception, IllegalStateException, UnsupportedOperationException { pool.addObject(); }
/** * {@inheritDoc} */ public void destroyObject(final K key, final V obj) throws Exception { synchronized (lock) { keyedFactory.destroyObject(key, obj); } }
/** * Activate the object, ignoring the key. * * @param key ignored * @param obj object to be activated */ public void activateObject(final K key, final V obj) throws Exception { factory.activateObject(obj); }
/** * {@inheritDoc} */ public void addObject(final K key) throws Exception, IllegalStateException, UnsupportedOperationException { keyedPool.addObject(key); }
/** * {@inheritDoc} */ public void clear() throws Exception, UnsupportedOperationException { pool.clear(); }
/** * {@inheritDoc} */ public int getNumIdle(final K key) throws UnsupportedOperationException { return keyedPool.getNumIdle(key); }
/** * {@inheritDoc} */ public void clear(final K key) throws Exception, UnsupportedOperationException { synchronized (lock) { keyedPool.clear(key); } }
/** * {@inheritDoc} */ public void clear() throws Exception, UnsupportedOperationException { keyedPool.clear(); }