Package org.apache.tomcat.util.threads
Class VirtualThreadExecutor
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- org.apache.tomcat.util.threads.VirtualThreadExecutor
-
- All Implemented Interfaces:
java.util.concurrent.Executor,java.util.concurrent.ExecutorService
public class VirtualThreadExecutor extends java.util.concurrent.AbstractExecutorServiceAn executor that uses a new virtual thread for each task.
-
-
Constructor Summary
Constructors Constructor Description VirtualThreadExecutor(java.lang.String namePrefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitTermination(long timeout, java.util.concurrent.TimeUnit unit)voidexecute(java.lang.Runnable command)booleanisShutdown()booleanisTerminated()voidshutdown()java.util.List<java.lang.Runnable>shutdownNow()
-
-
-
Method Detail
-
execute
public void execute(java.lang.Runnable command)
-
shutdown
public void shutdown()
-
shutdownNow
public java.util.List<java.lang.Runnable> shutdownNow()
The VirtualThreadExecutor does not track in-progress tasks so calling this method is equivalent to calling
shutdown().
-
isShutdown
public boolean isShutdown()
-
isTerminated
public boolean isTerminated()
The VirtualThreadExecutor does not track in-progress tasks so calling this method is equivalent to calling
isShutdown().
-
awaitTermination
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedExceptionThe VirtualThreadExecutor does not track in-progress tasks so calling this method is effectively waiting for
shutdown()to be called.- Throws:
java.lang.InterruptedException
-
-