Package one.tranic.t.util
Class Threads
java.lang.Object
one.tranic.t.util.Threads
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ExecutorServiceProvides an ExecutorService instance based on the current JVM version.
-
Constructor Details
-
Threads
public Threads()
-
-
Method Details
-
getExecutor
Provides an ExecutorService instance based on the current JVM version.For JVM versions 21 and above, it attempts to create a virtual thread-per-task executor using the new functionality introduced in the respective JVM version. For older versions, it falls back to a ThreadPoolExecutor with specific configurations.
- Returns:
- an ExecutorService instance suitable for the current JVM version; a virtual thread-per-task executor if supported, or a ThreadPoolExecutor otherwise.
-