RFR: 7357: Double-Checked Locking in Agent Plugin code [v2]

Jean-Philippe Bempel jpbempel at openjdk.java.net
Mon Jul 26 10:24:09 UTC 2021


On Mon, 26 Jul 2021 07:00:27 GMT, Guru Hb <ghb at openjdk.org> wrote:

>> Trivial Fortify warning fix
>
> Guru Hb has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fixing formatting error

application/org.openjdk.jmc.console.agent/src/main/java/org/openjdk/jmc/console/agent/manager/model/PresetRepositoryFactory.java line 53:

> 51: 		if (singleton == null) {
> 52: 			synchronized (PresetRepositoryFactory.class) {
> 53: 				singleton = create();

Actually, singleton field need also to be `volatile`.
see https://shipilev.net/blog/2014/safe-public-construction/ for more info

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

PR: https://git.openjdk.java.net/jmc/pull/282


More information about the jmc-dev mailing list