and
Resolve [POOL-356](https://issues.apache.org/jira/browse/POOL-356) as well as resolve regression issue due to i.e.
@@ -581,6 +581,11 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T>
} catch (final Exception e) {
swallowException(e);
}
+ try {
+ ensureIdle(1, false);
+ } catch (final Exception e) {
+ swallowException(e);
+ }
} else {
if (getLifo()) {
idleObjects.addFirst(p);
@@ -935,15 +940,6 @@ public class GenericObjectPool<T> extends BaseGenericObjectPool<T>
destroyedCount.incrementAndGet();
createCount.decrementAndGet();
}
-
- if (idleObjects.isEmpty() && idleObjects.hasTakeWaiters()) {
- // POOL-356.
- // In case there are already threads waiting on something in the pool
- // (e.g. idleObjects.takeFirst(); then we need to provide them a fresh instance.
- // Otherwise they will be stuck forever (or until timeout)
- final PooledObject<T> freshPooled = create();
- idleObjects.put(freshPooled);
- }
}
@Override
