RFR: 8372526: Add support for ZLIB TLS Certificate Compression [v17]
Xue-Lei Andrew Fan
xuelei at openjdk.org
Thu Feb 5 04:14:24 UTC 2026
On Thu, 5 Feb 2026 02:13:38 GMT, Artur Barashev <abarashev at openjdk.org> wrote:
>> src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java line 236:
>>
>>> 234: return compCertCache;
>>> 235: }
>>> 236:
>>
>> Thank you for the update, @artur-oracle! As sslContext instance are normally run in multiple threads context, could cache operation synchronization be a concern?
>
> I considered synchronization but I don't think it's really needed, the situation is the same as with cache being static actually:
>
> - `SoftMemoryCache` being used is already synchronized internally for `get` and `put` operations.
> - Race condition is possible in between `get` and `put` operations in `CompressedCertProducer`, but the worst that can happen is that we compress and insert the same certMsg into cache twice. Not something worth locking the whole cache while we compress IMO.
> - I chose `SoftMemoryCache` over `ConcurrentHashMap` because of LRU and soft reference mechanisms. Otherwise the former provides finer per-bucket synchronization and atomic `computeIfAbsent` call.
Make sense to me. Thank you @artur-oracle!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28682#discussion_r2766962306
More information about the net-dev
mailing list