return new ErodingPerKeyKeyedObjectPool<K, V>(keyedPool, factor); } else { return new ErodingKeyedObjectPool<K, V>(keyedPool, factor);
boolean discard = false; final long now = System.currentTimeMillis(); final ErodingFactor factor = getErodingFactor(key); synchronized (keyedPool) { if (factor.getNextShrink() < now) { final int numIdle = numIdle(key); if (numIdle > 0) { discard = true;
return new ErodingPerKeyKeyedObjectPool<K, V>(keyedPool, factor); } else { return new ErodingKeyedObjectPool<K, V>(keyedPool, factor);
return new ErodingPerKeyKeyedObjectPool(keyedPool, factor); } else { return new ErodingKeyedObjectPool(keyedPool, factor);
return new ErodingPerKeyKeyedObjectPool(keyedPool, factor); } else { return new ErodingKeyedObjectPool(keyedPool, factor);
return new ErodingPerKeyKeyedObjectPool<K, V>(keyedPool, factor); } else { return new ErodingKeyedObjectPool<K, V>(keyedPool, factor);
boolean discard = false; final long now = System.currentTimeMillis(); final ErodingFactor factor = getErodingFactor(key); synchronized (keyedPool) { if (factor.getNextShrink() < now) { final int numIdle = numIdle(key); if (numIdle > 0) { discard = true;
boolean discard = false; final long now = System.currentTimeMillis(); final ErodingFactor factor = getErodingFactor(key); synchronized (keyedPool) { if (factor.getNextShrink() < now) { final int numIdle = numIdle(key); if (numIdle > 0) { discard = true;
public void returnObject(final Object key, final Object obj) throws Exception { boolean discard = false; final long now = System.currentTimeMillis(); final ErodingFactor factor = getErodingFactor(key); synchronized (keyedPool) { if (factor.getNextShrink() < now) { final int numIdle = numIdle(key); if (numIdle > 0) { discard = true; } factor.update(now, numIdle); } } try { if (discard) { keyedPool.invalidateObject(key, obj); } else { keyedPool.returnObject(key, obj); } } catch (Exception e) { // swallowed } }
public void returnObject(final Object key, final Object obj) throws Exception { boolean discard = false; final long now = System.currentTimeMillis(); final ErodingFactor factor = getErodingFactor(key); synchronized (keyedPool) { if (factor.getNextShrink() < now) { final int numIdle = numIdle(key); if (numIdle > 0) { discard = true; } factor.update(now, numIdle); } } try { if (discard) { keyedPool.invalidateObject(key, obj); } else { keyedPool.returnObject(key, obj); } } catch (Exception e) { // swallowed } }
protected int numIdle(final Object key) { return getKeyedPool().getNumIdle(); }
/** * 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(); }
/** * 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(); }
protected int numIdle(final Object key) { return getKeyedPool().getNumIdle(); }
/** * 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(); }