Synchronized methods and virtual threads

Andrew Haley aph-open at littlepinkcloud.com
Sun Jun 2 11:07:39 UTC 2024


On 6/1/24 17:56, Alex wrote:
> Before this fix many projects did fixes and replaced synchronized with Lock. What is the latest recommendation? Keep replacing synchronized with Lock or wait for Java 23 and use synchronized methods?

I'd use Lock for the future. Synchronized plays very badly with Value
Objects, for example. Being able to synchronize on any object is something
of a legacy feature.

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671



More information about the loom-dev mailing list