Enum ThreadKind

java.lang.Object
java.lang.Enum<ThreadKind>
com.codename1.backend.annotations.ThreadKind
All Implemented Interfaces:
Comparable<ThreadKind>

public enum ThreadKind extends Enum<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 Details

    • AUTO

      public static final ThreadKind 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

      public static final ThreadKind VIRTUAL
      A virtual thread, falling back to a platform thread where there are none (the Java SE runtime, a TLS server, Windows).
    • PLATFORM

      public static final ThreadKind PLATFORM
      A thread of the executor's pool.
  • Method Details

    • values

      public static ThreadKind[] 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

      public static ThreadKind valueOf(String name)
      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 name
      NullPointerException - if the argument is null