This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch POOL_2_X in repository https://gitbox.apache.org/repos/asf/commons-pool.git
commit b95eb5d6918af1cd7e48b0b11deee28b3dfa97d6 Author: Gary Gregory <[email protected]> AuthorDate: Fri Nov 21 20:51:17 2025 +0000 Use final No need to nest else clause --- .../commons/pool2/impl/GenericKeyedObjectPool.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java index 993bfc85..82cfda09 100644 --- a/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java +++ b/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java @@ -804,7 +804,7 @@ public class GenericKeyedObjectPool<K, T> extends BaseGenericObjectPool<T> * @return The new, wrapped pooled object. May return null. * @throws Exception If the objection creation fails. */ - private PooledObject<T> create(final K key, Duration maxWaitDuration) throws Exception { + private PooledObject<T> create(final K key, final Duration maxWaitDuration) throws Exception { final Instant startInstant = Instant.now(); Duration remainingWaitDuration = maxWaitDuration.isNegative() ? Duration.ZERO : maxWaitDuration; @@ -853,15 +853,13 @@ public class GenericKeyedObjectPool<K, T> extends BaseGenericObjectPool<T> // create a new object. Return and wait for an object to // be returned. create = Boolean.FALSE; - } else { - // There are makeObject() calls in progress that might - // bring the pool to capacity. Those calls might also - // fail so wait until they complete and then re-test if - // the pool is at capacity or not. - if (!remainingWaitDuration.isNegative()) { - objectDeque.makeObjectCountLock.wait(remainingWaitDuration.toMillis(), - remainingWaitDuration.getNano() % 1_000_000); - } + } else // There are makeObject() calls in progress that might + // bring the pool to capacity. Those calls might also + // fail so wait until they complete and then re-test if + // the pool is at capacity or not. + if (!remainingWaitDuration.isNegative()) { + objectDeque.makeObjectCountLock.wait(remainingWaitDuration.toMillis(), + remainingWaitDuration.getNano() % 1_000_000); } } else { // The pool is not at capacity. Create a new object.
