RFR: 8267990: Revisit some uses of `synchronized` in the HttpClient API

Daniel Fuchs dfuchs at openjdk.java.net
Mon May 31 16:27:33 UTC 2021

The Utils.remaining(List<ByteBuffer> list) method assumes that it can and should synchronize on the given list to prevent concurrent modification. In 99% of the cases this assumption is wrong. There's only one such list (the SSLFlowDelegate writeList) that requires this synchronization. 

Also the `SequentialScheduler.synchronizedScheduler` uses `synchronized`, it could use a Lock instead and this would make it possible to assert that there is no contention (since the logic of the SequentialScheduler is supposed to prevent contention from occurring at this place).


Commit messages:
 - 8267990: Revisit some uses of `synchronized` in the HttpClient API

Changes: https://git.openjdk.java.net/jdk/pull/4275/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4275&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8267990
  Stats: 101 lines in 13 files changed: 59 ins; 6 del; 36 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4275.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4275/head:pull/4275

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

More information about the security-dev mailing list