On Wed, 28 Apr 2021 18:44:18 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:
>> I think the method is called during module bootstrap - I don't think there >> is a race in practice. This method is also called in other parts of >> ModuleBootstrap. The code you allude to is called during initialization of >> the IllegalNativeAccessChecker singleton, which should happen only once, and >> only from one thread. > > I'll take your word for it - the use of a volatile variable to store the > singleton instance made this suspicious. good point - I think that came in when I adapted the code from IllegalAccessLogger - which can indeed be accessed from multiple threads. In this case the initialization is effectively part of bootstrap, and volatile is not required. ------------- PR: https://git.openjdk.java.net/jdk/pull/3699