Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8288330

Avoid redundant ConcurrentHashMap.get call in Http2ClientImpl.deleteConnection

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P5
    • 20
    • None
    • core-libs
    • None
    • b03

    Description

      Method Http2ClientImpl.deleteConnection removes Http2Connection from ConcurrentHashMap 'connections' if it's present in the map. It performs this with 2 steps: first invoke ConcurrentHashMap.get and then check if result of 'get' is equals to parameter.

              synchronized (this) {
                  Http2Connection c1 = connections.get(c.key());
                  if (c1 != null && c1.equals(c)) {
                      connections.remove(c.key());
                      if (debug.on())
                          debug.log("removed from the connection pool: %s", c);
                  }
              }

      We can do better: there is single method 'ConcurrentHashMap.remove(Key, Value)' which does the same thing, but faster.

      Attachments

        Issue Links

          Activity

            People

              aturbanov Andrey Turbanov
              aturbanov Andrey Turbanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: