diff --git a/extensions/virtual-threads/runtime/src/main/java/io/quarkus/virtual/threads/FallbackVirtualThreadsExecutorService.java b/extensions/virtual-threads/runtime/src/main/java/io/quarkus/virtual/threads/FallbackVirtualThreadsExecutorService.java index 01c89c19481f9..b2fa837d6df9e 100644 --- a/extensions/virtual-threads/runtime/src/main/java/io/quarkus/virtual/threads/FallbackVirtualThreadsExecutorService.java +++ b/extensions/virtual-threads/runtime/src/main/java/io/quarkus/virtual/threads/FallbackVirtualThreadsExecutorService.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.concurrent.AbstractExecutorService; import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; import io.smallrye.mutiny.infrastructure.Infrastructure; import io.vertx.core.Vertx; @@ -18,6 +19,8 @@ */ class FallbackVirtualThreadsExecutorService extends AbstractExecutorService { + private AtomicBoolean shutdown = new AtomicBoolean(); + @Override public void execute(Runnable command) { var context = Vertx.currentContext(); @@ -33,26 +36,28 @@ public void execute(Runnable command) { @Override public void shutdown() { - // no-op + shutdown.compareAndSet(false, true); } @Override public List shutdownNow() { + shutdown.compareAndSet(false, true); return Collections.EMPTY_LIST; } @Override public boolean isShutdown() { - return false; + return shutdown.get(); } @Override public boolean isTerminated() { - return false; + return shutdown.get(); } @Override public boolean awaitTermination(long timeout, TimeUnit unit) { - return false; + shutdown.compareAndSet(false, true); + return true; } }