On Mon, 9 Jan 2023 17:34:06 GMT, Sergey Bylokhov <s...@openjdk.org> wrote:

> Please clarify that, if the field is updated on one thread under synchronized 
> block, why we will read the correct "currentKeyID" here on another thread if 
> no synchronization is used in this place?

I only said that if another thread reads the new value of `currentKeyID`, the 
corresponding key will already be in the `keyHashMap` because that happened 
before updating `currentKeyID`. If another thread will read the old value of 
`currentKeyID` that also will be no problem as discussed before in this PR.

-------------

PR: https://git.openjdk.org/jdk/pull/11590

Reply via email to