On Tue, 3 Feb 2026 13:54:02 GMT, Artur Barashev <[email protected]> wrote:

> While option 2 is more likely, I suggest to explore both options. The 
> important thing with option 2 is to make sure we don't compare certificates 
> or CRLs with `==` operator anywhere in OpenJDK code (so far I've only done a 
> quick research on this). Then we can remove synchronization around 
> `certCache` and `crlCache` completely and update `intern` methods javadoc (or 
> maybe rename those methods to avoid any confusion). Those are static caches 
> shared across the whole VM, so we want to make sure the locking is reduced to 
> the bare minimum, especially since it's been documented to be an issue.

Following the discussion on the trade-off between removing synchronization 
entirely vs. keeping minimal synchronization, the current change keeps the soft 
cache policy unchanged and removes the coarse synchronized methods. 
Synchronization is now limited to `addIfNotPresent`, where the small 
`synchronized` block only makes the check-and-insert step atomic, preserving 
best-effort intern-like convergence under concurrency. Parsing/building remains 
outside the lock, so no expensive work is serialized. This provides a balanced 
middle ground.

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

PR Comment: https://git.openjdk.org/jdk/pull/29181#issuecomment-3976397558

Reply via email to