ruanLN commented on code in PR #450:
URL: https://github.com/apache/commons-pool/pull/450#discussion_r2624613346


##########
src/main/java/org/apache/commons/pool3/impl/GenericObjectPool.java:
##########
@@ -513,6 +513,11 @@ private PooledObject<T> create(final Duration 
maxWaitDurationRequest) throws E {
         if (localMaxTotal < 0) {
             localMaxTotal = Integer.MAX_VALUE;
         }
+        int localMaxIdle = getMaxIdle();
+        if (localMaxIdle < 0) {
+            localMaxIdle = Integer.MAX_VALUE;
+        }
+        final int maxCapacity = Math.min(localMaxTotal, localMaxIdle);

Review Comment:
   This will cause issues if maxIdle is set to zero, making it impossible to 
create new objects in the pool.
   
   Since the method is private we can verify it is only used during the borrow, 
where it is not added to the idle objects, and on addObject, where it is.
   
   the `addObject` method should be checking the idle object limit isn't being 
crossed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to