Package org.apache.pekko.dispatch
Class VirtualThreadSupport
- java.lang.Object
-
- org.apache.pekko.dispatch.VirtualThreadSupport
-
public class VirtualThreadSupport extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VirtualThreadSupport.CarrierThreadFactory$
-
Constructor Summary
Constructors Constructor Description VirtualThreadSupport()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.concurrent.ForkJoinPool
getVirtualThreadDefaultScheduler()
Try to get the default scheduler of virtual thread.static boolean
isSupported()
Is virtual thread supportedstatic java.util.concurrent.ExecutorService
newThreadPerTaskExecutor(java.util.concurrent.ThreadFactory threadFactory)
Create a newThreadPerTaskExecutor with the specified thread factory.static java.util.concurrent.ThreadFactory
newVirtualThreadFactory(java.lang.String prefix)
Create a virtual thread factory with the default Virtual Thread executor.static java.util.concurrent.ThreadFactory
newVirtualThreadFactory(java.lang.String prefix, java.util.concurrent.ExecutorService executor)
Create a virtual thread factory with the specified executor as the scheduler of virtual thread.
-
-
-
Method Detail
-
isSupported
public static boolean isSupported()
Is virtual thread supported
-
newThreadPerTaskExecutor
public static java.util.concurrent.ExecutorService newThreadPerTaskExecutor(java.util.concurrent.ThreadFactory threadFactory)
Create a newThreadPerTaskExecutor with the specified thread factory.
-
newVirtualThreadFactory
public static java.util.concurrent.ThreadFactory newVirtualThreadFactory(java.lang.String prefix)
Create a virtual thread factory with the default Virtual Thread executor.
-
newVirtualThreadFactory
public static java.util.concurrent.ThreadFactory newVirtualThreadFactory(java.lang.String prefix, java.util.concurrent.ExecutorService executor)
Create a virtual thread factory with the specified executor as the scheduler of virtual thread.
-
getVirtualThreadDefaultScheduler
public static java.util.concurrent.ForkJoinPool getVirtualThreadDefaultScheduler()
Try to get the default scheduler of virtual thread.
-
-