Enum Class TargetThread

java.lang.Object
java.lang.Enum<TargetThread>
dev.crafty.core.task.api.TargetThread
All Implemented Interfaces:
Serializable, Comparable<TargetThread>, Constable

public enum TargetThread extends Enum<TargetThread>
An enumeration representing the target execution thread for asynchronous tasks.

This enum is primarily used in conjunction with methods provided by the

invalid reference
Async
interface to specify the thread on which a task should be executed.

The available thread targets are:

- VIRTUAL: Indicates that the task should run on a virtual thread.

- PLATFORM: Indicates that the task should run on a platform-specific thread.

- MAIN: Indicates that the task should run on the main thread.

Since:
1.0.0
  • Enum Constant Details

    • VIRTUAL

      public static final TargetThread VIRTUAL
      Represents a virtual thread as the target execution context for a task.

      When this option is used, the task will execute on a virtual thread, which is lightweight and managed by the Java runtime, allowing for highly concurrent and scalable task execution.

    • PLATFORM

      public static final TargetThread PLATFORM
      Represents a platform-specific thread as the target execution context for a task. This option indicates that the task should execute on a thread determined by the platform, which may depend on the underlying operating system or runtime configuration.

      This is used for more CPU-intensive workloads. For normal-intensity workloads and IO calls, use VIRTUAL

    • MAIN

      public static final TargetThread MAIN
      Represents the main thread as the target execution context for a task. This option specifies that the task should execute on the main thread.
  • Method Details

    • values

      public static TargetThread[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TargetThread valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null