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

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new fb7896e132 Clean-up #861
fb7896e132 is described below

commit fb7896e1324abebca5f5ce16c15a662ed96e81e4
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue May 27 09:39:18 2025 +0100

    Clean-up #861
---
 java/org/apache/tomcat/util/threads/RetryableQueue.java |  9 ++++++++-
 java/org/apache/tomcat/util/threads/TaskQueue.java      | 11 ++---------
 webapps/docs/changelog.xml                              |  7 +++++++
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/java/org/apache/tomcat/util/threads/RetryableQueue.java 
b/java/org/apache/tomcat/util/threads/RetryableQueue.java
index 54da92c4d3..fe60fe4d9b 100644
--- a/java/org/apache/tomcat/util/threads/RetryableQueue.java
+++ b/java/org/apache/tomcat/util/threads/RetryableQueue.java
@@ -21,6 +21,13 @@ import java.util.concurrent.BlockingQueue;
 
 public interface RetryableQueue<T> extends BlockingQueue<T> {
 
+    /**
+     * Used to add a task to the queue if the task has been rejected by the 
Executor.
+     *
+     * @param o         The task to add to the queue
+     *
+     * @return          {@code true} if the task was added to the queue,
+     *                      otherwise {@code false}
+     */
     boolean force(T o);
-
 }
diff --git a/java/org/apache/tomcat/util/threads/TaskQueue.java 
b/java/org/apache/tomcat/util/threads/TaskQueue.java
index f88058eadc..1b5f730c6a 100644
--- a/java/org/apache/tomcat/util/threads/TaskQueue.java
+++ b/java/org/apache/tomcat/util/threads/TaskQueue.java
@@ -31,7 +31,7 @@ import org.apache.tomcat.util.res.StringManager;
  * there are idle threads and you won't be able to force items onto the queue
  * itself.
  */
-public class TaskQueue extends LinkedBlockingQueue<Runnable> implements 
RetryableQueue<Runnable>{
+public class TaskQueue extends LinkedBlockingQueue<Runnable> implements 
RetryableQueue<Runnable> {
 
     @Serial
     private static final long serialVersionUID = 1L;
@@ -56,14 +56,7 @@ public class TaskQueue extends LinkedBlockingQueue<Runnable> 
implements Retryabl
     }
 
 
-    /**
-     * Used to add a task to the queue if the task has been rejected by the 
Executor.
-     *
-     * @param o         The task to add to the queue
-     *
-     * @return          {@code true} if the task was added to the queue,
-     *                      otherwise {@code false}
-     */
+    @Override
     public boolean force(Runnable o) {
         if (parent == null || parent.isShutdown()) {
             throw new 
RejectedExecutionException(sm.getString("taskQueue.notRunning"));
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index a769bdfd4c..be5dbd5c8d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -202,6 +202,13 @@
         Remove NIO2 connector. (remm)
       </update>
       <!-- Entries for backport and removal before 12.0.0-M1 below this line 
-->
+      <scode>
+        <pr>861</pr>: Refactor <code>TaskQueue</code> to use the new interface
+        <code>RetryableQueue</code> which enables better integration of custom
+        <code>Executor</code>s which provide their own
+        <code>BlockingQueue</code> implementation. Pull request provided by
+        Paulo Almeida. (markt)
+      </scode>
     </changelog>
   </subsection>
   <subsection name="Jasper">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to