Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In addition to to the Thread API, the java.util.concurrent.ExecutorService and Executors APIs are have been updated to make it easy to work with virtual threads. Unlike traditional threads pools, virtual Vrtual threads are cheap enough that a new virtual thread can be created for each task, no need for pooling of threads.

...

Appendix: Differences between regular Threads and virtual ThreadsThread API

The following is a list of the subtle differences between the two types of thread:

  1. VirtualThread always report their priority as NORM_PRIORITY. The priority is not inherited and cannot be changed with the setPriority method.
  2. Virtual threads are daemon threads. Their daemon status cannot be changed with the setDaemon method.
  3. Virtual threads cannot be suspend, resumed or stopped with the Thread suspend, resume and stop APIs.
  4. Virtual threads have no permissions when running with a security manager.
  5. Virtual threads are not active threads in their thread group. The getThreadGroup method returns a ThreadGroup that cannot be destroyed and its enumerate methods do not enumerate the virtual threads in the group.

Networking APIs

...