Integrated: 8288330: Avoid redundant ConcurrentHashMap.get call in Http2ClientImpl.deleteConnection
Andrey Turbanov
aturbanov at openjdk.java.net
Wed Jun 15 18:15:19 UTC 2022
On Thu, 9 Jun 2022 21:08:35 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
> https://github.com/openjdk/jdk/blob/900d967da52afca9b239d8a58aa81b48b9fe0a78/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java#L191-L196
>
> Method `Http2ClientImpl.deleteConnection` removes `Http2Connection` from `ConcurrentHashMap` if it's present in the map. It does it with 2 steps: first invoke `ConcurrentHashMap.get` and then check if result of `get` is equals to parameter.
>
> We can do better: there is single method `ConcurrentHashMap.remove(Key, Value)` which does the same thing, but faster.
>
> Testing: `test/jdk/java/net/httpclient` on Win x64 release.
This pull request has now been integrated.
Changeset: 3475e12f
Author: Andrey Turbanov <aturbanov at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/3475e12fa6c50dbaf53b6b03f3b8032017394c1f
Stats: 3 lines in 1 file changed: 0 ins; 2 del; 1 mod
8288330: Avoid redundant ConcurrentHashMap.get call in Http2ClientImpl.deleteConnection
Reviewed-by: jpai, dfuchs
-------------
PR: https://git.openjdk.org/jdk/pull/9114
More information about the net-dev
mailing list