Buildbot success in on tomcat-11.0.x
Build status: Build succeeded! Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/112/builds/1684 Blamelist: Mark Thomas Build Text: build successful Status Detected: restored build Build Source Stamp: [branch 11.0.x] 2a4daaf99fb879396b244083aaffa0fa552e51f5 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 shell_6: 0 shell_7: 0 compile: 1 shell_8: 0 shell_9: 0 shell_10: 0 shell_11: 0 Rsync docs to nightlies.apache.org: 0 shell_12: 0 Rsync RAT to nightlies.apache.org: 0 compile_1: 1 shell_13: 0 Rsync Logs to nightlies.apache.org: 0 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [PR] Refactor TaskQueue to use RetryableQueue interface [tomcat]
PauloMigAlmeida commented on PR #861: URL: https://github.com/apache/tomcat/pull/861#issuecomment-2911914316 Thanks @markt-asf ! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: (tomcat) branch 9.0.x updated: Code clean-up - formatting. No functional change.
On 22/05/2025 17:53, ma...@apache.org wrote: This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new 7dd670b5cc Code clean-up - formatting. No functional change. 7dd670b5cc is described below commit 7dd670b5ccd83f4129ccd72a9792d677ee6a7dbe Author: Mark Thomas AuthorDate: Thu May 22 17:53:04 2025 +0100 Code clean-up - formatting. No functional change. Sorry. Just realised this one removed some "unused" imports. Fixing that now. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) 01/02: Refactor TaskQueue to use RetryableQueue interface
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit f7129cf0eeaea499f513a03e34b4546ddec8d33f Author: PauloMigAlmeida AuthorDate: Mon May 26 21:35:06 2025 +1200 Refactor TaskQueue to use RetryableQueue interface Additional clean-up by markt --- .../apache/tomcat/util/threads/RetryableQueue.java | 52 ++ java/org/apache/tomcat/util/threads/TaskQueue.java | 27 ++- .../tomcat/util/threads/ThreadPoolExecutor.java| 4 +- webapps/docs/changelog.xml | 11 + 4 files changed, 68 insertions(+), 26 deletions(-) diff --git a/java/org/apache/tomcat/util/threads/RetryableQueue.java b/java/org/apache/tomcat/util/threads/RetryableQueue.java new file mode 100644 index 00..f636b10dfa --- /dev/null +++ b/java/org/apache/tomcat/util/threads/RetryableQueue.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tomcat.util.threads; + +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.TimeUnit; + +public interface RetryableQueue extends BlockingQueue { + +/** + * 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); + +/** + * 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 + * @param timeout The timeout to use when adding the task + * @param unit The units in which the timeout is expressed + * + * @return {@code true} if the task was added to the queue, + * otherwise {@code false} + * + * @throws InterruptedException If the call is interrupted before the + * timeout expires + * + * @deprecated Unused. Will be removed in Tomcat 10.1.x. + */ +@Deprecated +boolean force(Runnable o, long timeout, TimeUnit unit) throws InterruptedException; +} diff --git a/java/org/apache/tomcat/util/threads/TaskQueue.java b/java/org/apache/tomcat/util/threads/TaskQueue.java index 755658a7de..67fe06963b 100644 --- a/java/org/apache/tomcat/util/threads/TaskQueue.java +++ b/java/org/apache/tomcat/util/threads/TaskQueue.java @@ -30,7 +30,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 { +public class TaskQueue extends LinkedBlockingQueue implements RetryableQueue { private static final long serialVersionUID = 1L; protected static final StringManager sm = StringManager.getManager(TaskQueue.class); @@ -54,14 +54,7 @@ public class TaskQueue extends LinkedBlockingQueue { } -/** - * 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")); @@ -70,21 +63,7 @@ public class TaskQueue extends LinkedBlockingQueue { } -/** - * 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 - * @param timeout The timeout to use when adding the task - * @param unit The units in which the timeout is expressed - * - * @return {@code true} if the task was added to the queue, - * otherwise {@code false} - * - * @throws InterruptedException If the call is interrupted before the - *
(tomcat) 02/02: Restore imports incorrectly removed during code formatting
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 245f079db6d8bce1ae116cce1f22dd27e00c20f3 Author: Mark Thomas AuthorDate: Tue May 27 11:20:09 2025 +0100 Restore imports incorrectly removed during code formatting --- java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java | 5 + java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java| 5 + java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java | 3 +++ .../apache/tomcat/util/net/openssl/panama/OpenSSLSessionContext.java | 2 ++ .../apache/tomcat/util/net/openssl/panama/OpenSSLSessionStats.java | 2 ++ 5 files changed, 17 insertions(+) diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java index ad58a8ed39..4b60ec676e 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java @@ -20,6 +20,11 @@ import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; +import java.lang.foreign.Arena; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.ValueLayout; +import java.lang.ref.Cleaner; +import java.lang.ref.Cleaner.Cleanable; import java.nio.charset.StandardCharsets; import java.security.KeyManagementException; import java.security.SecureRandom; diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java index 2a0311c0ad..e746840683 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java @@ -18,6 +18,11 @@ package org.apache.tomcat.util.net.openssl.panama; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.lang.foreign.Arena; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.ValueLayout; +import java.lang.ref.Cleaner; +import java.lang.ref.Cleaner.Cleanable; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URI; diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java index 68825eb5a7..7272db9cf2 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java @@ -17,6 +17,9 @@ package org.apache.tomcat.util.net.openssl.panama; +import java.lang.foreign.Arena; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.ValueLayout; import java.security.SecureRandom; import java.util.ArrayList; import java.util.List; diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionContext.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionContext.java index 1cfe463912..5921287acd 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionContext.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionContext.java @@ -16,6 +16,8 @@ */ package org.apache.tomcat.util.net.openssl.panama; +import java.lang.foreign.Arena; +import java.lang.foreign.ValueLayout; import java.util.Enumeration; import java.util.NoSuchElementException; diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionStats.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionStats.java index 70f71d6c7c..31a3912bef 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionStats.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionStats.java @@ -16,6 +16,8 @@ */ package org.apache.tomcat.util.net.openssl.panama; +import java.lang.foreign.MemorySegment; + import static org.apache.tomcat.util.openssl.openssl_h.*; /** - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 9.0.x updated (edb92552e1 -> 245f079db6)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git from edb92552e1 Support parsing multiple path parameters in a single URL segment. new f7129cf0ee Refactor TaskQueue to use RetryableQueue interface new 245f079db6 Restore imports incorrectly removed during code formatting The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../util/net/openssl/panama/OpenSSLContext.java| 5 +++ .../util/net/openssl/panama/OpenSSLEngine.java | 5 +++ .../util/net/openssl/panama/OpenSSLLibrary.java| 3 ++ .../net/openssl/panama/OpenSSLSessionContext.java | 2 + .../net/openssl/panama/OpenSSLSessionStats.java| 2 + .../apache/tomcat/util/threads/RetryableQueue.java | 52 ++ java/org/apache/tomcat/util/threads/TaskQueue.java | 27 ++- .../tomcat/util/threads/ThreadPoolExecutor.java| 4 +- webapps/docs/changelog.xml | 11 + 9 files changed, 85 insertions(+), 26 deletions(-) create mode 100644 java/org/apache/tomcat/util/threads/RetryableQueue.java - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 10.1.x updated: Restore imports incorrectly removed during code formatting
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new 18de8e8b5e Restore imports incorrectly removed during code formatting 18de8e8b5e is described below commit 18de8e8b5e3707dd5a9ebccd73262d1d6a2ba2a4 Author: Mark Thomas AuthorDate: Tue May 27 11:27:07 2025 +0100 Restore imports incorrectly removed during code formatting --- java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java | 3 +++ java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java | 3 +++ java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java | 3 +++ .../apache/tomcat/util/net/openssl/panama/OpenSSLSessionContext.java | 2 ++ .../org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionStats.java | 2 ++ 5 files changed, 13 insertions(+) diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java index 598068a11b..4b60ec676e 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java @@ -20,6 +20,9 @@ import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; +import java.lang.foreign.Arena; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.ValueLayout; import java.lang.ref.Cleaner; import java.lang.ref.Cleaner.Cleanable; import java.nio.charset.StandardCharsets; diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java index ae88101d76..6f8ef25a28 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLEngine.java @@ -18,6 +18,9 @@ package org.apache.tomcat.util.net.openssl.panama; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.lang.foreign.Arena; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.ValueLayout; import java.lang.ref.Cleaner; import java.lang.ref.Cleaner.Cleanable; import java.net.HttpURLConnection; diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java index 68825eb5a7..7272db9cf2 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.java @@ -17,6 +17,9 @@ package org.apache.tomcat.util.net.openssl.panama; +import java.lang.foreign.Arena; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.ValueLayout; import java.security.SecureRandom; import java.util.ArrayList; import java.util.List; diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionContext.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionContext.java index 1cfe463912..5921287acd 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionContext.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionContext.java @@ -16,6 +16,8 @@ */ package org.apache.tomcat.util.net.openssl.panama; +import java.lang.foreign.Arena; +import java.lang.foreign.ValueLayout; import java.util.Enumeration; import java.util.NoSuchElementException; diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionStats.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionStats.java index 70f71d6c7c..31a3912bef 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionStats.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLSessionStats.java @@ -16,6 +16,8 @@ */ package org.apache.tomcat.util.net.openssl.panama; +import java.lang.foreign.MemorySegment; + import static org.apache.tomcat.util.openssl.openssl_h.*; /** - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Buildbot success in on tomcat-9.0.x
Build status: Build succeeded! Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/37/builds/1416 Blamelist: Mark Thomas , PauloMigAlmeida Build Text: build successful Status Detected: restored build Build Source Stamp: [branch 9.0.x] 245f079db6d8bce1ae116cce1f22dd27e00c20f3 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 shell_6: 0 compile: 1 shell_7: 0 shell_8: 0 shell_9: 0 shell_10: 0 Rsync docs to nightlies.apache.org: 0 shell_11: 0 Rsync RAT to nightlies.apache.org: 0 compile_1: 1 shell_12: 0 Rsync Logs to nightlies.apache.org: 0 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: (tomcat) branch 9.0.x updated: Code clean-up - formatting. No functional change.
On Tue, May 27, 2025 at 12:16 PM Mark Thomas wrote: > > On 22/05/2025 17:53, ma...@apache.org wrote: > > This is an automated email from the ASF dual-hosted git repository. > > > > markt pushed a commit to branch 9.0.x > > in repository https://gitbox.apache.org/repos/asf/tomcat.git > > > > > > The following commit(s) were added to refs/heads/9.0.x by this push: > > new 7dd670b5cc Code clean-up - formatting. No functional change. > > 7dd670b5cc is described below > > > > commit 7dd670b5ccd83f4129ccd72a9792d677ee6a7dbe > > Author: Mark Thomas > > AuthorDate: Thu May 22 17:53:04 2025 +0100 > > > > Code clean-up - formatting. No functional change. > > Sorry. Just realised this one removed some "unused" imports. Fixing that > now. Well, that's why we have GH actions, so it's all good. Rémy - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Buildbot failure in on tomcat-10.1.x
Build status: BUILD FAILED: failed Snapshot deployed to ASF Maven snapshot repository (failure) Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/44/builds/1763 Blamelist: Mark Thomas , PauloMigAlmeida Build Text: failed Snapshot deployed to ASF Maven snapshot repository (failure) Status Detected: new failure Build Source Stamp: [branch 10.1.x] 18de8e8b5e3707dd5a9ebccd73262d1d6a2ba2a4 Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 shell_6: 0 compile: 1 shell_7: 0 shell_8: 0 shell_9: 2 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Support parsing multiple path parameters in a single URL segment.
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 81e3c3fd39 Support parsing multiple path parameters in a single URL segment. 81e3c3fd39 is described below commit 81e3c3fd39190c7824994a171ff4956210b4a78f Author: Mark Thomas AuthorDate: Tue May 27 09:24:22 2025 +0100 Support parsing multiple path parameters in a single URL segment. Parameters separated by ';' Based on #860 by Chenjp. --- java/org/apache/catalina/util/RequestUtil.java | 23 -- .../TestApplicationContextStripPathParams.java | 4 webapps/docs/changelog.xml | 5 + 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/java/org/apache/catalina/util/RequestUtil.java b/java/org/apache/catalina/util/RequestUtil.java index 36f5f072a6..bc123387cb 100644 --- a/java/org/apache/catalina/util/RequestUtil.java +++ b/java/org/apache/catalina/util/RequestUtil.java @@ -60,8 +60,10 @@ public final class RequestUtil { /** * Strip parameters for given path. - * @param input the input path + * + * @param input the input path * @param request the request to add the parameters to + * * @return the cleaned path */ public static String stripPathParams(String input, Request request) { @@ -85,19 +87,20 @@ public final class RequestUtil { } else { pos = followingSlash; } -if (request != null && nextSemiColon + 1 -1 && equals + 1 < pathVariable.length()) { -String name = pathVariable.substring(0, equals); -String value = pathVariable.substring(equals + 1); -request.addPathParameter(name, value); +if (request != null && nextSemiColon + 1 < pos) { +String pathVariablesString = input.substring(nextSemiColon + 1, pos); +String[] pathVariables = pathVariablesString.split(";"); +for (String pathVariable : pathVariables) { +int equals = pathVariable.indexOf('='); +if (equals > -1 && equals + 1 < pathVariable.length()) { +String name = pathVariable.substring(0, equals); +String value = pathVariable.substring(equals + 1); +request.addPathParameter(name, value); +} } } } return sb.toString(); } - - } diff --git a/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java b/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java index a1a083c660..a06fa8538c 100644 --- a/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java +++ b/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java @@ -62,6 +62,10 @@ public class TestApplicationContextStripPathParams extends TomcatBaseTest { { ";/foo;=/bar", "/foo/bar", Boolean.FALSE }, { ";/foo;a=/bar", "/foo/bar", Boolean.FALSE }, { ";/foo;=1/bar", "/foo/bar", Boolean.FALSE }, +{ "/foo;a=1;b=1/bar", "/foo/bar", Boolean.TRUE }, +{ ";/foo;a=1;b=1/bar", "/foo/bar", Boolean.TRUE }, +{ "/foo;b=1;a=1/bar", "/foo/bar", Boolean.TRUE }, +{ ";/foo;b=1;a=1/bar", "/foo/bar", Boolean.TRUE }, }); } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 0f5905ab02..a769bdfd4c 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -179,6 +179,11 @@ getParts() is these circumstances will trigger an exception. (markt) + +Support parsing of multiple path parameters separated by ; +in a single URL segment. Based on pull request 860 by Chenjp. +(markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 11.0.x updated: Support parsing multiple path parameters in a single URL segment.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/11.0.x by this push: new 2a4daaf99f Support parsing multiple path parameters in a single URL segment. 2a4daaf99f is described below commit 2a4daaf99fb879396b244083aaffa0fa552e51f5 Author: Mark Thomas AuthorDate: Tue May 27 09:24:22 2025 +0100 Support parsing multiple path parameters in a single URL segment. Parameters separated by ';' Based on #860 by Chenjp. --- java/org/apache/catalina/util/RequestUtil.java | 23 -- .../TestApplicationContextStripPathParams.java | 4 webapps/docs/changelog.xml | 5 + 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/java/org/apache/catalina/util/RequestUtil.java b/java/org/apache/catalina/util/RequestUtil.java index 36f5f072a6..bc123387cb 100644 --- a/java/org/apache/catalina/util/RequestUtil.java +++ b/java/org/apache/catalina/util/RequestUtil.java @@ -60,8 +60,10 @@ public final class RequestUtil { /** * Strip parameters for given path. - * @param input the input path + * + * @param input the input path * @param request the request to add the parameters to + * * @return the cleaned path */ public static String stripPathParams(String input, Request request) { @@ -85,19 +87,20 @@ public final class RequestUtil { } else { pos = followingSlash; } -if (request != null && nextSemiColon + 1 -1 && equals + 1 < pathVariable.length()) { -String name = pathVariable.substring(0, equals); -String value = pathVariable.substring(equals + 1); -request.addPathParameter(name, value); +if (request != null && nextSemiColon + 1 < pos) { +String pathVariablesString = input.substring(nextSemiColon + 1, pos); +String[] pathVariables = pathVariablesString.split(";"); +for (String pathVariable : pathVariables) { +int equals = pathVariable.indexOf('='); +if (equals > -1 && equals + 1 < pathVariable.length()) { +String name = pathVariable.substring(0, equals); +String value = pathVariable.substring(equals + 1); +request.addPathParameter(name, value); +} } } } return sb.toString(); } - - } diff --git a/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java b/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java index a1a083c660..a06fa8538c 100644 --- a/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java +++ b/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java @@ -62,6 +62,10 @@ public class TestApplicationContextStripPathParams extends TomcatBaseTest { { ";/foo;=/bar", "/foo/bar", Boolean.FALSE }, { ";/foo;a=/bar", "/foo/bar", Boolean.FALSE }, { ";/foo;=1/bar", "/foo/bar", Boolean.FALSE }, +{ "/foo;a=1;b=1/bar", "/foo/bar", Boolean.TRUE }, +{ ";/foo;a=1;b=1/bar", "/foo/bar", Boolean.TRUE }, +{ "/foo;b=1;a=1/bar", "/foo/bar", Boolean.TRUE }, +{ ";/foo;b=1;a=1/bar", "/foo/bar", Boolean.TRUE }, }); } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index b0cdda2e61..bf6ca589d3 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -120,6 +120,11 @@ getParts() is these circumstances will trigger an exception. (markt) + +Support parsing of multiple path parameters separated by ; +in a single URL segment. Based on pull request 860 by Chenjp. +(markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 9.0.x updated: Support parsing multiple path parameters in a single URL segment.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/9.0.x by this push: new edb92552e1 Support parsing multiple path parameters in a single URL segment. edb92552e1 is described below commit edb92552e1f15829ec81b0ce99b2bc2f2b4a4b17 Author: Mark Thomas AuthorDate: Tue May 27 09:24:22 2025 +0100 Support parsing multiple path parameters in a single URL segment. Parameters separated by ';' Based on #860 by Chenjp. --- java/org/apache/catalina/util/RequestUtil.java | 23 -- .../TestApplicationContextStripPathParams.java | 4 webapps/docs/changelog.xml | 5 + 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/java/org/apache/catalina/util/RequestUtil.java b/java/org/apache/catalina/util/RequestUtil.java index d8a9de92ce..f2a27a3e79 100644 --- a/java/org/apache/catalina/util/RequestUtil.java +++ b/java/org/apache/catalina/util/RequestUtil.java @@ -60,8 +60,10 @@ public final class RequestUtil { /** * Strip parameters for given path. - * @param input the input path + * + * @param input the input path * @param request the request to add the parameters to + * * @return the cleaned path */ public static String stripPathParams(String input, Request request) { @@ -85,19 +87,20 @@ public final class RequestUtil { } else { pos = followingSlash; } -if (request != null && nextSemiColon + 1 -1 && equals + 1 < pathVariable.length()) { -String name = pathVariable.substring(0, equals); -String value = pathVariable.substring(equals + 1); -request.addPathParameter(name, value); +if (request != null && nextSemiColon + 1 < pos) { +String pathVariablesString = input.substring(nextSemiColon + 1, pos); +String[] pathVariables = pathVariablesString.split(";"); +for (String pathVariable : pathVariables) { +int equals = pathVariable.indexOf('='); +if (equals > -1 && equals + 1 < pathVariable.length()) { +String name = pathVariable.substring(0, equals); +String value = pathVariable.substring(equals + 1); +request.addPathParameter(name, value); +} } } } return sb.toString(); } - - } diff --git a/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java b/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java index 3d8a52b7e1..3739770644 100644 --- a/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java +++ b/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java @@ -62,6 +62,10 @@ public class TestApplicationContextStripPathParams extends TomcatBaseTest { { ";/foo;=/bar", "/foo/bar", Boolean.FALSE }, { ";/foo;a=/bar", "/foo/bar", Boolean.FALSE }, { ";/foo;=1/bar", "/foo/bar", Boolean.FALSE }, +{ "/foo;a=1;b=1/bar", "/foo/bar", Boolean.TRUE }, +{ ";/foo;a=1;b=1/bar", "/foo/bar", Boolean.TRUE }, +{ "/foo;b=1;a=1/bar", "/foo/bar", Boolean.TRUE }, +{ ";/foo;b=1;a=1/bar", "/foo/bar", Boolean.TRUE }, }); } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index ae81979f60..40cdf0f2b5 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -111,6 +111,11 @@ Add support for the java:module namespace which mirrors the java:comp namespace. (markt) + +Support parsing of multiple path parameters separated by ; +in a single URL segment. Based on pull request 860 by Chenjp. +(markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [PR] Fix issue on multiple path parameters processing in RequestUtil [tomcat]
markt-asf closed pull request #860: Fix issue on multiple path parameters processing in RequestUtil URL: https://github.com/apache/tomcat/pull/860 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [PR] Fix issue on multiple path parameters processing in RequestUtil [tomcat]
markt-asf commented on PR #860: URL: https://github.com/apache/tomcat/pull/860#issuecomment-2911642918 Thanks for the PR. I merged this manually as I wanted to modify the variable naming slightly and add a couple of additional tests. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 10.1.x updated: Support parsing multiple path parameters in a single URL segment.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new 1ad4013340 Support parsing multiple path parameters in a single URL segment. 1ad4013340 is described below commit 1ad40133401c22bc5de5165381e640a8b7806ad7 Author: Mark Thomas AuthorDate: Tue May 27 09:24:22 2025 +0100 Support parsing multiple path parameters in a single URL segment. Parameters separated by ';' Based on #860 by Chenjp. --- java/org/apache/catalina/util/RequestUtil.java | 23 -- .../TestApplicationContextStripPathParams.java | 4 webapps/docs/changelog.xml | 5 + 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/java/org/apache/catalina/util/RequestUtil.java b/java/org/apache/catalina/util/RequestUtil.java index 36f5f072a6..bc123387cb 100644 --- a/java/org/apache/catalina/util/RequestUtil.java +++ b/java/org/apache/catalina/util/RequestUtil.java @@ -60,8 +60,10 @@ public final class RequestUtil { /** * Strip parameters for given path. - * @param input the input path + * + * @param input the input path * @param request the request to add the parameters to + * * @return the cleaned path */ public static String stripPathParams(String input, Request request) { @@ -85,19 +87,20 @@ public final class RequestUtil { } else { pos = followingSlash; } -if (request != null && nextSemiColon + 1 -1 && equals + 1 < pathVariable.length()) { -String name = pathVariable.substring(0, equals); -String value = pathVariable.substring(equals + 1); -request.addPathParameter(name, value); +if (request != null && nextSemiColon + 1 < pos) { +String pathVariablesString = input.substring(nextSemiColon + 1, pos); +String[] pathVariables = pathVariablesString.split(";"); +for (String pathVariable : pathVariables) { +int equals = pathVariable.indexOf('='); +if (equals > -1 && equals + 1 < pathVariable.length()) { +String name = pathVariable.substring(0, equals); +String value = pathVariable.substring(equals + 1); +request.addPathParameter(name, value); +} } } } return sb.toString(); } - - } diff --git a/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java b/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java index 3d8a52b7e1..3739770644 100644 --- a/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java +++ b/test/org/apache/catalina/core/TestApplicationContextStripPathParams.java @@ -62,6 +62,10 @@ public class TestApplicationContextStripPathParams extends TomcatBaseTest { { ";/foo;=/bar", "/foo/bar", Boolean.FALSE }, { ";/foo;a=/bar", "/foo/bar", Boolean.FALSE }, { ";/foo;=1/bar", "/foo/bar", Boolean.FALSE }, +{ "/foo;a=1;b=1/bar", "/foo/bar", Boolean.TRUE }, +{ ";/foo;a=1;b=1/bar", "/foo/bar", Boolean.TRUE }, +{ "/foo;b=1;a=1/bar", "/foo/bar", Boolean.TRUE }, +{ ";/foo;b=1;a=1/bar", "/foo/bar", Boolean.TRUE }, }); } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index c00031277d..748b14a55e 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -111,6 +111,11 @@ Add support for the java:module namespace which mirrors the java:comp namespace. (markt) + +Support parsing of multiple path parameters separated by ; +in a single URL segment. Based on pull request 860 by Chenjp. +(markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [PR] Refactor TaskQueue to use RetryableQueue interface [tomcat]
markt-asf commented on PR #861: URL: https://github.com/apache/tomcat/pull/861#issuecomment-2911655569 This looks to be a reasonable request. There are a few additional changes that will also be required. I'll merge this. Make the additional changes and then back-port the combination. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [PR] Refactor TaskQueue to use RetryableQueue interface [tomcat]
markt-asf merged PR #861: URL: https://github.com/apache/tomcat/pull/861 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Buildbot failure in on tomcat-12.0.x
Build status: BUILD FAILED: failed Snapshot deployed to ASF Maven snapshot repository (failure) Worker used: bb_worker2_ubuntu URL: https://ci2.apache.org/#builders/120/builds/568 Blamelist: Mark Thomas Build Text: failed Snapshot deployed to ASF Maven snapshot repository (failure) Status Detected: new failure Build Source Stamp: [branch main] 81e3c3fd39190c7824994a171ff4956210b4a78f Steps: worker_preparation: 0 git: 0 shell: 0 shell_1: 0 shell_2: 0 shell_3: 0 shell_4: 0 shell_5: 0 shell_6: 0 shell_7: 0 compile: 1 shell_8: 0 shell_9: 0 shell_10: 2 -- ASF Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Clean-up #861
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 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 extends BlockingQueue { +/** + * 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 implements RetryableQueue{ +public class TaskQueue extends LinkedBlockingQueue implements RetryableQueue { @Serial private static final long serialVersionUID = 1L; @@ -56,14 +56,7 @@ public class TaskQueue extends LinkedBlockingQueue 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) + +861: Refactor TaskQueue to use the new interface +RetryableQueue which enables better integration of custom +Executors which provide their own +BlockingQueue implementation. Pull request provided by +Paulo Almeida. (markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch main updated: Refactor TaskQueue to use RetryableQueue interface
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 9b27e48a81 Refactor TaskQueue to use RetryableQueue interface 9b27e48a81 is described below commit 9b27e48a81e0ab859a22ba6882815d318bf053fe Author: PauloMigAlmeida AuthorDate: Mon May 26 21:35:06 2025 +1200 Refactor TaskQueue to use RetryableQueue interface --- .../apache/tomcat/util/threads/RetryableQueue.java | 26 ++ java/org/apache/tomcat/util/threads/TaskQueue.java | 2 +- .../tomcat/util/threads/ThreadPoolExecutor.java| 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/java/org/apache/tomcat/util/threads/RetryableQueue.java b/java/org/apache/tomcat/util/threads/RetryableQueue.java new file mode 100644 index 00..54da92c4d3 --- /dev/null +++ b/java/org/apache/tomcat/util/threads/RetryableQueue.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tomcat.util.threads; + +import java.util.concurrent.BlockingQueue; + +public interface RetryableQueue extends BlockingQueue { + +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 fda8d1c244..f88058eadc 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 { +public class TaskQueue extends LinkedBlockingQueue implements RetryableQueue{ @Serial private static final long serialVersionUID = 1L; diff --git a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java index 2e5be26325..c32769a1e0 100644 --- a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java +++ b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java @@ -1335,7 +1335,7 @@ public class ThreadPoolExecutor extends AbstractExecutorService { try { executeInternal(command); } catch (RejectedExecutionException rx) { -if (getQueue() instanceof TaskQueue queue) { +if (getQueue() instanceof RetryableQueue queue) { // If the Executor is close to maximum pool size, concurrent // calls to execute() may result (due to Tomcat's use of // TaskQueue) in some tasks being rejected rather than queued. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
(tomcat) branch 11.0.x updated: Refactor TaskQueue to use RetryableQueue interface
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/11.0.x by this push: new 5d2d7f98ad Refactor TaskQueue to use RetryableQueue interface 5d2d7f98ad is described below commit 5d2d7f98ad614b4892868264ed270634938b5761 Author: PauloMigAlmeida AuthorDate: Mon May 26 21:35:06 2025 +1200 Refactor TaskQueue to use RetryableQueue interface Additional clean-up by markt --- .../apache/tomcat/util/threads/RetryableQueue.java | 33 ++ java/org/apache/tomcat/util/threads/TaskQueue.java | 11 ++-- .../tomcat/util/threads/ThreadPoolExecutor.java| 2 +- webapps/docs/changelog.xml | 11 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/java/org/apache/tomcat/util/threads/RetryableQueue.java b/java/org/apache/tomcat/util/threads/RetryableQueue.java new file mode 100644 index 00..fe60fe4d9b --- /dev/null +++ b/java/org/apache/tomcat/util/threads/RetryableQueue.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tomcat.util.threads; + +import java.util.concurrent.BlockingQueue; + +public interface RetryableQueue extends BlockingQueue { + +/** + * 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 fda8d1c244..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 { +public class TaskQueue extends LinkedBlockingQueue implements RetryableQueue { @Serial private static final long serialVersionUID = 1L; @@ -56,14 +56,7 @@ public class TaskQueue extends LinkedBlockingQueue { } -/** - * 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/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java index 2e5be26325..c32769a1e0 100644 --- a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java +++ b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java @@ -1335,7 +1335,7 @@ public class ThreadPoolExecutor extends AbstractExecutorService { try { executeInternal(command); } catch (RejectedExecutionException rx) { -if (getQueue() instanceof TaskQueue queue) { +if (getQueue() instanceof RetryableQueue queue) { // If the Executor is close to maximum pool size, concurrent // calls to execute() may result (due to Tomcat's use of // TaskQueue) in some tasks being rejected rather than queued. diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index bf6ca589d3..a7f818aca7 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -127,6 +127,17 @@ + + + +861: Refactor TaskQueue to use the new interface +RetryableQueue which enables better integration of custom +Executors which provide their own +BlockingQueue implementation. Pull request provided by +Paulo
(tomcat) branch 10.1.x updated: Refactor TaskQueue to use RetryableQueue interface
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 10.1.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/10.1.x by this push: new 3bd3d0f9b8 Refactor TaskQueue to use RetryableQueue interface 3bd3d0f9b8 is described below commit 3bd3d0f9b80dc629deaec98c3283e13e21a03c04 Author: PauloMigAlmeida AuthorDate: Mon May 26 21:35:06 2025 +1200 Refactor TaskQueue to use RetryableQueue interface Additional clean-up by markt --- .../apache/tomcat/util/threads/RetryableQueue.java | 33 ++ java/org/apache/tomcat/util/threads/TaskQueue.java | 11 ++-- .../tomcat/util/threads/ThreadPoolExecutor.java| 4 +-- webapps/docs/changelog.xml | 11 4 files changed, 48 insertions(+), 11 deletions(-) diff --git a/java/org/apache/tomcat/util/threads/RetryableQueue.java b/java/org/apache/tomcat/util/threads/RetryableQueue.java new file mode 100644 index 00..fe60fe4d9b --- /dev/null +++ b/java/org/apache/tomcat/util/threads/RetryableQueue.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.tomcat.util.threads; + +import java.util.concurrent.BlockingQueue; + +public interface RetryableQueue extends BlockingQueue { + +/** + * 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 7ff4e3e586..bec0fb31c2 100644 --- a/java/org/apache/tomcat/util/threads/TaskQueue.java +++ b/java/org/apache/tomcat/util/threads/TaskQueue.java @@ -30,7 +30,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 { +public class TaskQueue extends LinkedBlockingQueue implements RetryableQueue { private static final long serialVersionUID = 1L; protected static final StringManager sm = StringManager.getManager(TaskQueue.class); @@ -54,14 +54,7 @@ public class TaskQueue extends LinkedBlockingQueue { } -/** - * 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/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java index aef2c6ca89..17651ed1fa 100644 --- a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java +++ b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java @@ -1375,12 +1375,12 @@ public class ThreadPoolExecutor extends AbstractExecutorService { try { executeInternal(command); } catch (RejectedExecutionException rx) { -if (getQueue() instanceof TaskQueue) { +if (getQueue() instanceof RetryableQueue) { // If the Executor is close to maximum pool size, concurrent // calls to execute() may result (due to Tomcat's use of // TaskQueue) in some tasks being rejected rather than queued. // If this happens, add them to the queue. -final TaskQueue queue = (TaskQueue) getQueue(); +final RetryableQueue queue = (RetryableQueue) getQueue(); if (!queue.force(command)) { submittedCount.decrementAndGet(); throw new RejectedExecutionException(sm.getString("threadPoolExecutor.queueFull")
Re: [PR] [fix] ensure that when acceptor is stopped it doesn't log an error for nothing [tomcat]
markt-asf commented on PR #857: URL: https://github.com/apache/tomcat/pull/857#issuecomment-2911737766 On my clean install, Tomcat correctly handles disabling of IPv4 via `/proc/sys/net/ipv6/conf/all/disable_ipv6` at runtime. All the indications are that an issue with your environment that is causing the OS to report that an IPv6 interface is available when it is not. Tomcat correctly reports this as an error condition. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [PR] [fix] ensure that when acceptor is stopped it doesn't log an error for nothing [tomcat]
markt-asf closed pull request #857: [fix] ensure that when acceptor is stopped it doesn't log an error for nothing URL: https://github.com/apache/tomcat/pull/857 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [PR] Fix issue on multiple path parameters processing in RequestUtil [tomcat]
rmaucher commented on PR #860: URL: https://github.com/apache/tomcat/pull/860#issuecomment-2913059321 I verified this should not cause problems with the rewrite code. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org