Versions Compared

Key

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

Virtual threads are threads that are scheduled by the Java virtual machine rather than the operating system. They don't have their own API, instead the java.lang.Thread API has been updated to support the creation of virtual threads.

Thread API

The following uses a static factory method to create a virtual thread, invokes its start method to schedule it, and then invokes the join method to wait up to 5 seconds for the thread to terminate.

...