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

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

commit 9ca3d0bfbcf944357f9df4924cb04b56e60d774e
Author: remm <[email protected]>
AuthorDate: Fri Oct 16 17:41:23 2026 +0200

    Java compatibility
---
 java/org/apache/tomcat/util/net/AbstractEndpoint.java       | 4 ++--
 java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java 
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 0d2857b25d..49b92d9f88 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -1741,12 +1741,12 @@ public abstract class AbstractEndpoint<S, U> {
                 }
                 TaskQueue queue = (TaskQueue) tpe.getQueue();
                 queue.setParent(null);
-            } else if (executor instanceof VirtualThreadExecutor 
virtualThreadExecutor) {
+            } else if (executor instanceof VirtualThreadExecutor) {
                 // The virtual thread executor accepts new tasks until it is 
shut
                 // down. Shut it down, so tasks submitted via a reference 
captured
                 // before this point are rejected, as they are with the thread
                 // pool executor.
-                virtualThreadExecutor.shutdownNow();
+                ((VirtualThreadExecutor) executor).shutdownNow();
             }
         }
     }
diff --git a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java 
b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
index b0ef631544..2779f8e714 100644
--- a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
+++ b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java
@@ -1646,7 +1646,7 @@ public class ThreadPoolExecutor extends 
AbstractExecutorService {
         final AtomicInteger purged = new AtomicInteger(0);
         try {
             q.removeIf(r -> {
-                if (r instanceof Future<?> future && future.isCancelled()) {
+                if (r instanceof Future<?> && ((Future<?>) r).isCancelled()) {
                     purged.incrementAndGet();
                     return true;
                 }
@@ -1659,7 +1659,7 @@ public class ThreadPoolExecutor extends 
AbstractExecutorService {
             // before the interference occurred are already accounted for in
             // the purged count and will not appear in the copy taken below.
             for (Object r : q.toArray()) {
-                if (r instanceof Future<?> future && future.isCancelled() && 
q.remove(r)) {
+                if (r instanceof Future<?> && ((Future<?>) r).isCancelled() && 
q.remove(r)) {
                     purged.incrementAndGet();
                 }
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to