Package dev.crafty.core.task.api
Enum Class TargetThread
- All Implemented Interfaces:
Serializable
,Comparable<TargetThread>
,Constable
An enumeration representing the target execution thread for asynchronous tasks.
This enum is primarily used in conjunction with methods provided by the
interface
to specify the thread on which a task should be executed.
invalid reference
Async
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic TargetThread
Returns the enum constant of this class with the specified name.static TargetThread[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
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
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
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
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 nameNullPointerException
- if the argument is null
-