RFR: 8311030: ResourceBundle.handleKeySet() is racy

Daniel Fuchs dfuchs at openjdk.org
Thu Jun 29 13:17:59 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.

The new code makes it more visible that 1. keySet is expected to be volatile and 2. that there is no path were code could be reordered leading to the 'wrong' value of keySet being returned. So maybe there's no race, but the new code make it more obvious.

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

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


More information about the core-libs-dev mailing list