RFR: 8358318: JFR: Tighten up PlatformTracer initialization [v2]

Aleksey Shipilev shade at openjdk.org
Mon Jun 2 17:28:32 UTC 2025


> Started as SonarCloud complaint that MethodSetting.apply initializes a static field. But I think there is a larger problem here, which I completely missed during [JDK-8352738](https://bugs.openjdk.org/browse/JDK-8352738) review: the `PlatformTracer` initialization can technically run several times, AFAICS. This PR tightens up the initialization. It also allows us to call `ensureInitialized` from other places, if we ever find a need.
> 
> Additional testing:
>  - [x] Linux x86_64 server fastdebug, `jdk_jfr`

Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:

 - Unsynchronized fix
 - Merge branch 'master' into JDK-8358318-jfr-platform-tracer-init
 - Fix

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25584/files
  - new: https://git.openjdk.org/jdk/pull/25584/files/b5635420..0d8c05a1

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25584&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25584&range=00-01

  Stats: 534 lines in 32 files changed: 309 ins; 146 del; 79 mod
  Patch: https://git.openjdk.org/jdk/pull/25584.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25584/head:pull/25584

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


More information about the hotspot-jfr-dev mailing list