Skip to content

Commit

Permalink
GH-39732 Update description of virtual threads
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasdo committed Feb 22, 2024
1 parent 118120c commit 31dcc00
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ If you're running on Java 21 or up, you can enable virtual threads by setting th
Before turning on this option for your application, you should consider https://docs.oracle.com/en/java/javase/21/core/virtual-threads.html[reading the official Java virtual threads documentation].
In some cases, applications can experience lower throughput because of "Pinned Virtual Threads"; this page also explains how to detect such cases with JDK Flight Recorder or the `jcmd` CLI.

WARNING: One side effect of virtual threads is that these threads are daemon threads.
A JVM will exit if there are no non-daemon threads.
WARNING: One side effect of virtual threads is that they are daemon threads.
A JVM will exit if all of its threads are daemon threads.
This behavior can be a problem when you rely on, e.g. `@Scheduled` beans to keep your application alive.
If you use virtual threads, the scheduler thread is a virtual thread and therefore a daemon thread and won't keep the JVM alive.
This does not only affect scheduling, but can be the case with other technologies, too!
Expand Down

0 comments on commit 31dcc00

Please sign in to comment.