RFR: 8311030: ResourceBundle.handleKeySet() is racy

Raffaello Giulietti rgiulietti at openjdk.org
Fri Jun 30 08:34:01 UTC 2023


On Wed, 28 Jun 2023 11:05:11 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:

> Double-checked locking should rely on local variable to avoid racy reads from volatile field.

True. I was mislead because the return statement does not appear in the changeset (the line is textually the same, although it has a different semantics: `keySet` now refers to a local), so I didn't count for it.

In the end, this PR is not about fixing a race, as the title seems to suggest (the original code is correct), but to avoid a volatile read, right?

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

PR Comment: https://git.openjdk.org/jdk/pull/14692#issuecomment-1614317093


More information about the core-libs-dev mailing list