You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2026/07/24 12:03:21 UTC

(maven-resolver) branch master updated: Fix InterruptedException silently dropping task in SmartExecutor.Limited.submit(Runnable) (#2012)

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

cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git


The following commit(s) were added to refs/heads/master by this push:
     new b749cad4c Fix InterruptedException silently dropping task in SmartExecutor.Limited.submit(Runnable) (#2012)
b749cad4c is described below

commit b749cad4ce66d779d6729018bfe55bec06f3d34f
Author: Elliotte Rusty Harold <el...@users.noreply.github.com>
AuthorDate: Fri Jul 24 12:03:16 2026 +0000

    Fix InterruptedException silently dropping task in SmartExecutor.Limited.submit(Runnable) (#2012)
    
    Fixes #1993
    
    In `Limited.submit(Runnable)` (line 155), if `semaphore.acquire()` throws `InterruptedException`, the interrupt flag was restored but the caller's task was never executed — it was silently dropped. The `submit(Callable)` variant correctly handles this by returning a failed `CompletableFuture`.
    
    This fix throws a `RuntimeException` wrapping the `InterruptedException` after restoring the interrupt flag, so the caller is notified that the task could not be submitted.
    
    ---------
    
    Co-authored-by: opencode <op...@example.com>
---
 .../main/java/org/eclipse/aether/util/concurrency/SmartExecutor.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/maven-resolver-util/src/main/java/org/eclipse/aether/util/concurrency/SmartExecutor.java b/maven-resolver-util/src/main/java/org/eclipse/aether/util/concurrency/SmartExecutor.java
index 3b2f25c1f..9755a9fc7 100644
--- a/maven-resolver-util/src/main/java/org/eclipse/aether/util/concurrency/SmartExecutor.java
+++ b/maven-resolver-util/src/main/java/org/eclipse/aether/util/concurrency/SmartExecutor.java
@@ -35,8 +35,10 @@ import java.util.concurrent.Semaphore;
 public interface SmartExecutor extends AutoCloseable {
     /**
      * Submits a {@link Runnable} to execution.
+     *
+     * @throws RejectedExecutionException If this executor cannot accept the task.
      */
-    void submit(Runnable runnable);
+    void submit(Runnable runnable) throws RejectedExecutionException;
 
     /**
      * Submits a {@link Callable} to execution, returns a {@link CompletableFuture}.
@@ -176,6 +178,7 @@ public interface SmartExecutor extends AutoCloseable {
                 }
             } catch (InterruptedException e) {
                 Thread.currentThread().interrupt();
+                throw new RejectedExecutionException(e);
             }
         }