On Wed, 29 Sep 2021 14:01:17 GMT, Andrey Turbanov 
<[email protected]> wrote:

> Possible race condition could happen if another thread put value into 
> 'metricsCache' by the same key.
> We can use `ConcurrentHashMap.remove(key, value)` method to avoid it.

The race condition isn't actually a problem, as we'd just need to repopulate 
the cache in this unlikely scenario, but the fix looks fine. I guess this 
method was just overlooked when the code was first written.

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

Marked as reviewed by prr (Reviewer).

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

Reply via email to