Skip to content

Commit

Permalink
[trivial] [website] Add a link to Locked from Synchronized.
Browse files Browse the repository at this point in the history
  • Loading branch information
rzwitserloot committed Sep 25, 2023
1 parent ca58ce0 commit d328ec3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions website/templates/features/Synchronized.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
If you want, you can create these locks yourself. The <code>$lock</code> and <code>$LOCK</code> 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 <code>@Synchronized</code> 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.
</p><p>
Locking on <code>this</code> 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.
</p><p>
If you would prefer <code>java.util.concurrent.locks</code> style locks (recommended if you're using virtual threads), have a look at <a href="Locked"><code>@Locked</code></a>.
</p>
</@f.overview>

Expand Down

0 comments on commit d328ec3

Please sign in to comment.