Can I please get a review of this change which proposes to fix the issue noted 
in https://bugs.openjdk.java.net/browse/JDK-8282617? 

The `HttpClient` class uses a `inCache` (internal) field to keep track of 
whether a connection is in the keep-alive cache. This is a mutable field and 
when dealing with this field the `HttpClient` class uses a lock.

The `HttpsClient` class extends this `HttpClient` class. It additionally 
overrides the `putInKeepAliveCache()` method to use a Https specific way of 
populating the keep alive cache. While doing so it also reads and updates the 
`inCache` `protected` field from its super `HttpClient` class, but doesn't use 
a lock to do so. This can thus cause a race condition when the `inCache` field 
gets accessed concurrently, for example a separate thread calling the 
`HttpClient#isInKeepAliveCache()` method.

To fix this issue, the commit here uses the same lock/unlock construct used in 
the `HttpClient` super class.

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

Commit messages:
 - 8282617: sun.net.www.protocol.https.HttpsClient#putInKeepAliveCache() 
doesn't use a lock while dealing with inCache field

Changes: https://git.openjdk.java.net/jdk/pull/7680/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7680&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8282617
  Stats: 13 lines in 1 file changed: 7 ins; 2 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7680.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7680/head:pull/7680

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

Reply via email to