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
commit 4ae47eb1021f84ff255601c40167f0cc0204ead9
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jul 21 16:59:01 2021 +0100

    Remove deprecated execute(Runnable, long, TimeUnit) method
---
 java/org/apache/catalina/Executor.java             | 23 ---------------
 .../catalina/core/StandardThreadExecutor.java      | 11 --------
 .../tomcat/util/threads/ThreadPoolExecutor.java    | 33 ++--------------------
 3 files changed, 2 insertions(+), 65 deletions(-)

diff --git a/java/org/apache/catalina/Executor.java 
b/java/org/apache/catalina/Executor.java
index b106f54..5ea6a12 100644
--- a/java/org/apache/catalina/Executor.java
+++ b/java/org/apache/catalina/Executor.java
@@ -16,30 +16,7 @@
  */
 package org.apache.catalina;
 
-import java.util.concurrent.TimeUnit;
-
 public interface Executor extends java.util.concurrent.Executor, Lifecycle {
 
     public String getName();
-
-    /**
-     * Executes the given command at some time in the future.  The command
-     * may execute in a new thread, in a pooled thread, or in the calling
-     * thread, at the discretion of the <code>Executor</code> implementation.
-     * If no threads are available, it will be added to the work queue.
-     * If the work queue is full, the system will wait for the specified
-     * time until it throws a RejectedExecutionException
-     *
-     * @param command the runnable task
-     * @param timeout the length of time to wait for the task to complete
-     * @param unit    the units in which timeout is expressed
-     *
-     * @throws java.util.concurrent.RejectedExecutionException if this task
-     * cannot be accepted for execution - the queue is full
-     * @throws NullPointerException if command or unit is null
-     *
-     * @deprecated Unused. Will be removed in Tomcat 10.1.x onwards.
-     */
-    @Deprecated
-    void execute(Runnable command, long timeout, TimeUnit unit);
 }
\ No newline at end of file
diff --git a/java/org/apache/catalina/core/StandardThreadExecutor.java 
b/java/org/apache/catalina/core/StandardThreadExecutor.java
index 5e7d4db..63559d1 100644
--- a/java/org/apache/catalina/core/StandardThreadExecutor.java
+++ b/java/org/apache/catalina/core/StandardThreadExecutor.java
@@ -158,17 +158,6 @@ public class StandardThreadExecutor extends 
LifecycleMBeanBase
 
 
     @Override
-    @Deprecated
-    public void execute(Runnable command, long timeout, TimeUnit unit) {
-        if (executor != null) {
-            executor.execute(command,timeout,unit);
-        } else {
-            throw new 
IllegalStateException(sm.getString("standardThreadExecutor.notStarted"));
-        }
-    }
-
-
-    @Override
     public void execute(Runnable command) {
         if (executor != null) {
             try {
diff --git a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java 
b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
index 2b9e931..f5b9b69 100644
--- a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
+++ b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
@@ -148,49 +148,20 @@ public class ThreadPoolExecutor extends 
java.util.concurrent.ThreadPoolExecutor
      */
     @Override
     public void execute(Runnable command) {
-        execute(command,0,TimeUnit.MILLISECONDS);
-    }
-
-    /**
-     * Executes the given command at some time in the future.  The command
-     * may execute in a new thread, in a pooled thread, or in the calling
-     * thread, at the discretion of the <code>Executor</code> implementation.
-     * If no threads are available, it will be added to the work queue.
-     * If the work queue is full, the system will wait for the specified
-     * time and it throw a RejectedExecutionException if the queue is still
-     * full after that.
-     *
-     * @param command the runnable task
-     * @param timeout A timeout for the completion of the task
-     * @param unit The timeout time unit
-     * @throws RejectedExecutionException if this task cannot be
-     * accepted for execution - the queue is full
-     * @throws NullPointerException if command or unit is null
-     *
-     * @deprecated This will be removed in Tomcat 10.1.x onwards
-     */
-    @Deprecated
-    public void execute(Runnable command, long timeout, TimeUnit unit) {
         submittedCount.incrementAndGet();
         try {
             super.execute(command);
         } catch (RejectedExecutionException rx) {
             if (super.getQueue() instanceof TaskQueue) {
                 final TaskQueue queue = (TaskQueue)super.getQueue();
-                try {
-                    if (!queue.force(command, timeout, unit)) {
-                        submittedCount.decrementAndGet();
-                        throw new 
RejectedExecutionException(sm.getString("threadPoolExecutor.queueFull"));
-                    }
-                } catch (InterruptedException x) {
+                if (!queue.force(command)) {
                     submittedCount.decrementAndGet();
-                    throw new RejectedExecutionException(x);
+                    throw new 
RejectedExecutionException(sm.getString("threadPoolExecutor.queueFull"));
                 }
             } else {
                 submittedCount.decrementAndGet();
                 throw rx;
             }
-
         }
     }
 

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

Reply via email to