On Thu, 29 May 2025 20:42:41 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:
>> test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008.java >> line 83: >> >>> 81: private ReferenceType rType, rTypeEx; >>> 82: private String cmd; >>> 83: private volatile int counter1 = 0, counter2 = 0; >> >> The volatile is not enough for increment. It might be not affect test if you >> check 0/non-0 only but still not a good way. >> Better to use AtomicInteger or set/read variable only. > > Since there is only one writer thread, volatile should be sufficient. The > only requirement is to make writes visible to the reader thread. volatile > accomplishes that. Thanks for explanation. Can you please add corresponding comment. The volatile counters are rare thing... ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25236#discussion_r2114765521