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

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


The following commit(s) were added to refs/heads/7.0.x by this push:
     new 38d1eb1  Align with 8.5.x & fix compilation after backport
38d1eb1 is described below

commit 38d1eb17eb80e9418480241d25fe4ec9737e4751
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Aug 28 13:22:10 2020 +0100

    Align with 8.5.x & fix compilation after backport
---
 java/org/apache/tomcat/util/threads/LimitLatch.java              | 5 +++++
 .../apache/tomcat/util/threads/StopPooledThreadException.java    | 2 +-
 java/org/apache/tomcat/util/threads/TaskQueue.java               | 9 +++++++--
 java/org/apache/tomcat/util/threads/TaskThreadFactory.java       | 9 +++++----
 java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java      | 6 +++---
 java/org/apache/tomcat/util/threads/res/LocalStrings.properties  | 3 +++
 .../apache/tomcat/util/threads/res/LocalStrings_fr.properties    | 3 +++
 .../apache/tomcat/util/threads/res/LocalStrings_ja.properties    | 3 +++
 .../apache/tomcat/util/threads/res/LocalStrings_ko.properties    | 3 +++
 .../apache/tomcat/util/threads/res/LocalStrings_zh_CN.properties | 3 +++
 10 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/java/org/apache/tomcat/util/threads/LimitLatch.java 
b/java/org/apache/tomcat/util/threads/LimitLatch.java
index 6ef2e64..840ec55 100644
--- a/java/org/apache/tomcat/util/threads/LimitLatch.java
+++ b/java/org/apache/tomcat/util/threads/LimitLatch.java
@@ -82,6 +82,7 @@ public class LimitLatch {
 
     /**
      * Obtain the current limit.
+     * @return the limit
      */
     public long getLimit() {
         return limit;
@@ -107,6 +108,7 @@ public class LimitLatch {
     /**
      * Acquires a shared latch if one is available or waits for one if no 
shared
      * latch is current available.
+     * @throws InterruptedException If the current thread is interrupted
      */
     public void countUpOrAwait() throws InterruptedException {
         if (log.isDebugEnabled()) {
@@ -131,6 +133,7 @@ public class LimitLatch {
     /**
      * Releases all waiting threads and causes the {@link #limit} to be ignored
      * until {@link #reset()} is called.
+     * @return <code>true</code> if release was done
      */
     public boolean releaseAll() {
         released = true;
@@ -149,6 +152,7 @@ public class LimitLatch {
     /**
      * Returns <code>true</code> if there is at least one thread waiting to
      * acquire the shared lock, otherwise returns <code>false</code>.
+     * @return <code>true</code> if threads are waiting
      */
     public boolean hasQueuedThreads() {
         return sync.hasQueuedThreads();
@@ -157,6 +161,7 @@ public class LimitLatch {
     /**
      * Provide access to the list of threads waiting to acquire this limited
      * shared latch.
+     * @return a collection of threads
      */
     public Collection<Thread> getQueuedThreads() {
         return sync.getQueuedThreads();
diff --git a/java/org/apache/tomcat/util/threads/StopPooledThreadException.java 
b/java/org/apache/tomcat/util/threads/StopPooledThreadException.java
index e1447e2..95b9c38 100644
--- a/java/org/apache/tomcat/util/threads/StopPooledThreadException.java
+++ b/java/org/apache/tomcat/util/threads/StopPooledThreadException.java
@@ -26,6 +26,6 @@ public class StopPooledThreadException extends 
RuntimeException {
     private static final long serialVersionUID = 1L;
 
     public StopPooledThreadException(String msg) {
-        super(msg, null, false, false);
+        super(msg, null);
     }
 }
diff --git a/java/org/apache/tomcat/util/threads/TaskQueue.java 
b/java/org/apache/tomcat/util/threads/TaskQueue.java
index cdd0bc2..35f1d89 100644
--- a/java/org/apache/tomcat/util/threads/TaskQueue.java
+++ b/java/org/apache/tomcat/util/threads/TaskQueue.java
@@ -21,6 +21,8 @@ import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.tomcat.util.res.StringManager;
+
 /**
  * As task queue specifically designed to run with a thread pool executor. The
  * task queue is optimised to properly utilize threads within a thread pool
@@ -31,6 +33,9 @@ import java.util.concurrent.TimeUnit;
 public class TaskQueue extends LinkedBlockingQueue<Runnable> {
 
     private static final long serialVersionUID = 1L;
+    protected static final StringManager sm = StringManager
+            .getManager("org.apache.tomcat.util.threads.res");
+    private static final int DEFAULT_FORCED_REMAINING_CAPACITY = -1;
 
     private transient volatile ThreadPoolExecutor parent = null;
 
@@ -55,12 +60,12 @@ public class TaskQueue extends 
LinkedBlockingQueue<Runnable> {
     }
 
     public boolean force(Runnable o) {
-        if (parent == null || parent.isShutdown()) throw new 
RejectedExecutionException("Executor not running, can't force a command into 
the queue");
+        if (parent == null || parent.isShutdown()) throw new 
RejectedExecutionException(sm.getString("taskQueue.notRunning"));
         return super.offer(o); //forces the item onto the queue, to be used if 
the task is rejected
     }
 
     public boolean force(Runnable o, long timeout, TimeUnit unit) throws 
InterruptedException {
-        if (parent == null || parent.isShutdown()) throw new 
RejectedExecutionException("Executor not running, can't force a command into 
the queue");
+        if (parent == null || parent.isShutdown()) throw new 
RejectedExecutionException(sm.getString("taskQueue.notRunning"));
         return super.offer(o,timeout,unit); //forces the item onto the queue, 
to be used if the task is rejected
     }
 
diff --git a/java/org/apache/tomcat/util/threads/TaskThreadFactory.java 
b/java/org/apache/tomcat/util/threads/TaskThreadFactory.java
index af63f11..c6db0a4 100644
--- a/java/org/apache/tomcat/util/threads/TaskThreadFactory.java
+++ b/java/org/apache/tomcat/util/threads/TaskThreadFactory.java
@@ -18,17 +18,19 @@ package org.apache.tomcat.util.threads;
 
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicInteger;
+
 /**
- * Simple task thread factory to use to create threads for an executor 
implementation.
- * @author fhanik
- *
+ * Simple task thread factory to use to create threads for an executor
+ * implementation.
  */
 public class TaskThreadFactory implements ThreadFactory {
+
     private final ThreadGroup group;
     private final AtomicInteger threadNumber = new AtomicInteger(1);
     private final String namePrefix;
     private final boolean daemon;
     private final int threadPriority;
+
     public TaskThreadFactory(String namePrefix, boolean daemon, int priority) {
         SecurityManager s = System.getSecurityManager();
         group = (s != null) ? s.getThreadGroup() : 
Thread.currentThread().getThreadGroup();
@@ -44,5 +46,4 @@ public class TaskThreadFactory implements ThreadFactory {
         t.setPriority(threadPriority);
         return t;
     }
-
 }
diff --git a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java 
b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
index 24bc84c..7298efa 100644
--- a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
+++ b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
@@ -31,7 +31,6 @@ import org.apache.tomcat.util.res.StringManager;
  * {@link #getSubmittedCount()} method, to be used to properly handle the work 
queue.
  * If a RejectedExecutionHandler is not specified a default one will be 
configured
  * and that one will always throw a RejectedExecutionException
- * @author fhanik
  *
  */
 public class ThreadPoolExecutor extends 
java.util.concurrent.ThreadPoolExecutor {
@@ -156,6 +155,8 @@ public class ThreadPoolExecutor extends 
java.util.concurrent.ThreadPoolExecutor
      * 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
@@ -170,11 +171,10 @@ public class ThreadPoolExecutor extends 
java.util.concurrent.ThreadPoolExecutor
                 try {
                     if (!queue.force(command, timeout, unit)) {
                         submittedCount.decrementAndGet();
-                        throw new RejectedExecutionException("Queue capacity 
is full.");
+                        throw new 
RejectedExecutionException(sm.getString("threadPoolExecutor.queueFull"));
                     }
                 } catch (InterruptedException x) {
                     submittedCount.decrementAndGet();
-                    Thread.interrupted();
                     throw new RejectedExecutionException(x);
                 }
             } else {
diff --git a/java/org/apache/tomcat/util/threads/res/LocalStrings.properties 
b/java/org/apache/tomcat/util/threads/res/LocalStrings.properties
index 938626f..3124491 100644
--- a/java/org/apache/tomcat/util/threads/res/LocalStrings.properties
+++ b/java/org/apache/tomcat/util/threads/res/LocalStrings.properties
@@ -13,4 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+taskQueue.notRunning=Executor not running, can't force a command into the queue
+
+threadPoolExecutor.queueFull=Queue capacity is full
 threadPoolExecutor.threadStoppedToAvoidPotentialLeak=Stopping thread [{0}] to 
avoid potential memory leaks after a context was stopped.
diff --git a/java/org/apache/tomcat/util/threads/res/LocalStrings_fr.properties 
b/java/org/apache/tomcat/util/threads/res/LocalStrings_fr.properties
index f80be7b..8d0d122 100644
--- a/java/org/apache/tomcat/util/threads/res/LocalStrings_fr.properties
+++ b/java/org/apache/tomcat/util/threads/res/LocalStrings_fr.properties
@@ -13,4 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+taskQueue.notRunning=L'exécuteur n'a pas été démarré, impossible d'ajouter une 
commande à la file d'attente
+
+threadPoolExecutor.queueFull=La file d'attente est pleine
 threadPoolExecutor.threadStoppedToAvoidPotentialLeak=Arrêt du thread [{0}] 
pour éviter de potentielles fuites de mémoire après l''arrêt d''un contexte
diff --git a/java/org/apache/tomcat/util/threads/res/LocalStrings_ja.properties 
b/java/org/apache/tomcat/util/threads/res/LocalStrings_ja.properties
index af55365..e374067 100644
--- a/java/org/apache/tomcat/util/threads/res/LocalStrings_ja.properties
+++ b/java/org/apache/tomcat/util/threads/res/LocalStrings_ja.properties
@@ -13,4 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+taskQueue.notRunning=Executor が動作していないため、コマンドを強制的にキューへ登録できません。
+
+threadPoolExecutor.queueFull=キューが一杯です。
 
threadPoolExecutor.threadStoppedToAvoidPotentialLeak=コンテキストが停止した後の潜在的なメモリリークを防ぐため、スレッド[{0}]を停止しています。
diff --git a/java/org/apache/tomcat/util/threads/res/LocalStrings_ko.properties 
b/java/org/apache/tomcat/util/threads/res/LocalStrings_ko.properties
index ad04282..4360b98 100644
--- a/java/org/apache/tomcat/util/threads/res/LocalStrings_ko.properties
+++ b/java/org/apache/tomcat/util/threads/res/LocalStrings_ko.properties
@@ -13,4 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+taskQueue.notRunning=Executor가 실행 중이지 않습니다. 명령을 강제로 큐에 넣을 수 없습니다.
+
+threadPoolExecutor.queueFull=큐의 용량이 꽉 찼습니다.
 threadPoolExecutor.threadStoppedToAvoidPotentialLeak=컨텍스트가 중지된 후에 발생할 수 있는 잠재적 
메모리 누수를 피하기 위하여, 쓰레드 [{0}]을(를) 중지시킵니다.
diff --git 
a/java/org/apache/tomcat/util/threads/res/LocalStrings_zh_CN.properties 
b/java/org/apache/tomcat/util/threads/res/LocalStrings_zh_CN.properties
index 543d102..26d70de 100644
--- a/java/org/apache/tomcat/util/threads/res/LocalStrings_zh_CN.properties
+++ b/java/org/apache/tomcat/util/threads/res/LocalStrings_zh_CN.properties
@@ -13,4 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+taskQueue.notRunning=执行器未运行,无法强制命令进入队列
+
+threadPoolExecutor.queueFull=队列容量已满
 
threadPoolExecutor.threadStoppedToAvoidPotentialLeak=停止线程[{0}],从而避免context停止后的潜在的内存泄漏


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

Reply via email to