This is an automated email from the ASF dual-hosted git repository.

rmaucher pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit c3686bf8c114718f4475cdc0eba19a6ddf21ba93
Author: opencode <[email protected]>
AuthorDate: Thu Oct 29 23:30:17 2026 +0100

    FairBlockingQueue: return the changed flag from addAll rather than a 
constant true
    
    Collection.addAll must report whether the queue changed, but addAll()
    iterated the source, offered each element ignoring the result, and
    returned true unconditionally, so addAll of an empty collection claimed
    a change that never happened. The method now accumulates the individual
    offer() results and returns them. offer() cannot return false today, so
    the observable change is limited to the empty-source case; the form is
    contract-shaped so a future bounded offer() would still be reported
    correctly.
---
 .../src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
index cbfcbbd341..f261ad9254 100644
--- 
a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
+++ 
b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
@@ -386,11 +386,12 @@ public class FairBlockingQueue<E> implements 
BlockingQueue<E> {
     @Override
     public boolean addAll(Collection<? extends E> c) {
         Iterator<? extends E> i = c.iterator();
+        boolean changed = false;
         while (i.hasNext()) {
             E e = i.next();
-            offer(e);
+            changed |= offer(e);
         }
-        return true;
+        return changed;
     }
 
     /**


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to