Skip to content

Commit 7a24303

Browse files
committed
JDK 24: notes
1 parent 836214e commit 7a24303

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

java-24/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@ To run each example use: `java --enable-preview --source 24 <FileName.java>`
126126
* `-XX:+UseZGC -XX:-ZGenerational`: will use generational ZGC and print a warning about obsolete option
127127
* **Flexible Constructor Bodies**
128128
* re-preview without change
129+
* **Synchronize Virtual Threads without Pinning**
130+
* change the virtual threads to release the platform threads when blocked by synchronized methods and statements
131+
* eliminates nearly all cases of virtual threads being pinned to platform thread
132+
* scenarios where the virtual threads can be pinned:
133+
* when inside a synchronized block, if it tries to get another object's monitor, the virtual thread is blocked and pinned until it can adquire the monitor
134+
* when it tries to invoke a synchronized method that is already locked by another thread, the virtual thread is pinned and blocked until it can adquire the monitor
135+
* the system property `jdk.tracePinnedThreads` was removed
136+
* recommendations:
137+
* use synchronized where practical, since it is more convenient and less error prone
138+
* use `ReentrantLock` and other APIs when more flexibility is required
129139
* **Module Import Declarations**
130140
* re-preview with two changes
131141
* import module `java.se` will import the entire Java SE API (`java.base`)

0 commit comments

Comments
 (0)