Class Threads

java.lang.Object
one.tranic.t.util.Threads

public class Threads extends Object
  • Constructor Details

    • Threads

      public Threads()
  • Method Details

    • getExecutor

      public static ExecutorService 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.