org.openjdk.jmh.util.Deduplicator vs threading issues
Aleksey Shipilev
aleksey.shipilev at oracle.com
Wed Apr 22 16:59:21 UTC 2015
On 04/22/2015 07:55 PM, Vladimir Sitnikov wrote:
> Deduplicator is used in static final field of Result class, so dragons
> would appear if Result objects are created concurrently.
>
> I think it makes sense to add synchronized modifier to
> org.openjdk.jmh.util.Deduplicator#dedup, so non-thread-safety issues
> would not bite us in future.
>
> Any comments?
Yes, Deduplicator should be thread-safe. ConcurrentHashMap.putIfAbsent
fits here better than synchronized. Please submit the patch.
Bug:
https://bugs.openjdk.java.net/browse/CODETOOLS-7901398
Thanks
-Aleksey.
More information about the jmh-dev
mailing list