You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What the problem is : Java 21 virtual thread might hinder its scalability when using synchronized
Based on Java doc Java 21 virtual thread
A virtual thread cannot be unmounted during blocking operations when it is pinned to its carrier. A virtual thread is pinned in the following situations:
The virtual thread runs code inside a synchronized block or method
The virtual thread runs a native method or a foreign function (see [Foreign Function and Memory API]
Pinning does not make an application incorrect, but it might hinder its scalability.
Try avoiding frequent and long-lived pinning by revising synchronized blocks or methods that run frequently and guarding potentially long I/O operations with java.util.concurrent.locks.ReentrantLock.
Describe the solution you'd like
Use java.util.concurrent.locks.ReentrantLock instead of synchronized
The text was updated successfully, but these errors were encountered:
What the problem is : Java 21 virtual thread might hinder its scalability when using synchronized
Based on Java doc Java 21 virtual thread
A virtual thread cannot be unmounted during blocking operations when it is pinned to its carrier. A virtual thread is pinned in the following situations:
Pinning does not make an application incorrect, but it might hinder its scalability.
Try avoiding frequent and long-lived pinning by revising synchronized blocks or methods that run frequently and guarding potentially long I/O operations with java.util.concurrent.locks.ReentrantLock.
Describe the solution you'd like
Use java.util.concurrent.locks.ReentrantLock instead of synchronized
The text was updated successfully, but these errors were encountered: