Enum ThreadKind
- All Implemented Interfaces:
Comparable<ThreadKind>
Which kind of thread runs background work: an Async method or a
Scheduled job.
A virtual thread is cheap to create and to switch, and many can wait on sockets at once: a PostgreSQL or MySQL query, an outbound HTTP call and a TLS handshake all park it, and its host runs other virtual threads meanwhile. What it must not do is block outside a socket. SQLite and file access are local calls that hold the host thread under it, and with it every other virtual thread that host is running, so work that uses them belongs on a platform thread.
-
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadKindReturns the enum constant of this type with the specified name.static ThreadKind[]values()Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class Enum
clone, compareTo, equals, getDeclaringClass, getEnumValues, hashCode, name, ordinal, setEnumValues, toString, valueOf
-
Enum Constant Details
-
AUTO
A virtual thread when this build and this server run them, a platform thread otherwise. The choice is logged once at start-up. -
VIRTUAL
A virtual thread, falling back to a platform thread where there are none (the Java SE runtime, a TLS server, Windows). -
PLATFORM
A thread of the executor's pool.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-