From d328ec35c18df71fdeb087d4dd9e19c1ac96387d Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 25 Sep 2023 06:30:21 +0200 Subject: [PATCH] [trivial] [website] Add a link to Locked from Synchronized. --- website/templates/features/Synchronized.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/templates/features/Synchronized.html b/website/templates/features/Synchronized.html index 113add0e38..85004b8822 100644 --- a/website/templates/features/Synchronized.html +++ b/website/templates/features/Synchronized.html @@ -9,6 +9,8 @@ If you want, you can create these locks yourself. The $lock and $LOCK fields will of course not be generated if you already created them yourself. You can also choose to lock on another field, by specifying it as parameter to the @Synchronized annotation. In this usage variant, the fields will not be created automatically, and you must explicitly create them yourself, or an error will be emitted.

Locking on this or your own class object can have unfortunate side-effects, as other code not under your control can lock on these objects as well, which can cause race conditions and other nasty threading-related bugs. +

+ If you would prefer java.util.concurrent.locks style locks (recommended if you're using virtual threads), have a look at @Locked.