RFR: 8259354 Fix race condition in AbstractEventStream.nextThreadName

Carter Kozak github.com+3854321+carterkozak at openjdk.java.net
Thu Jan 7 04:25:03 UTC 2021


The result of `AtomicLong.incrementAndGet()` is used rather than
incrementing the long and reading its value separately. The
previous approach allowed for the static counter to be incremented
several times before any caller read the value, resulting in
several callers with the same value.

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

Commit messages:
 - 8259354: Fix race condition in AbstractEventStream.nextThreadName

Changes: https://git.openjdk.java.net/jdk/pull/1871/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1871&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8259354
  Stats: 2 lines in 1 file changed: 0 ins; 1 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1871.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1871/head:pull/1871

PR: https://git.openjdk.java.net/jdk/pull/1871


More information about the hotspot-jfr-dev mailing list