Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public enum ThreadKind
- Object
- Enum<ThreadKind>
- ThreadKind
ImplementsComparable<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 constants
AUTO | A virtual thread when this build and this server run them, a platform thread otherwise. |
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. |
Methods
public static ThreadKind[] values() | |
public static ThreadKind valueOf(String name) |
Inherited methods
Enum constant details
AUTO
AUTOA virtual thread when this build and this server run them, a platform
thread otherwise. The choice is logged once at start-up.
VIRTUAL
VIRTUALA virtual thread, falling back to a platform thread where there are none
(the Java SE runtime, a TLS server, Windows).
PLATFORM
PLATFORMA thread of the executor’s pool.
Method details
values
public static ThreadKind[] values()valueOf
public static ThreadKind valueOf(String name)