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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 3e25e5b  Align with 9.0.x/10.0.x and fix compilation error
3e25e5b is described below

commit 3e25e5bf1d4a0879f9a378256e5cf98c12c58a21
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Aug 27 14:18:06 2020 +0100

    Align with 9.0.x/10.0.x and fix compilation error
---
 java/org/apache/tomcat/util/threads/TaskQueue.java               | 9 +++++++--
 java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java      | 2 +-
 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 +++
 7 files changed, 23 insertions(+), 3 deletions(-)

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/ThreadPoolExecutor.java 
b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
index 42db3df..7298efa 100644
--- a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
+++ b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
@@ -171,7 +171,7 @@ 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();
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