On Mon, 9 Jan 2023 16:12:18 GMT, Volker Simonis <simo...@openjdk.org> wrote:

>> src/java.base/share/classes/sun/security/ssl/SSLSessionContextImpl.java line 
>> 209:
>> 
>>> 207:     // Package-private, used only from 
>>> SessionTicketExtension.KeyState::getCurrentKey.
>>> 208:     SessionTicketExtension.StatelessKey getKey(HandshakeContext hc) {
>>> 209:         SessionTicketExtension.StatelessKey ssk = 
>>> keyHashMap.get(currentKeyID);
>> 
>> is it safe to assume that the "currentKeyID" initialized/updated before on a 
>> different thread can be correctly read here?
>
> Yes, because `currentKeyID` is updated in a synchronized section *after* the 
> corresponding key was added to `keyHashMap`.

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?

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

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

Reply via email to