WW-5647 Use ConcurrentHashMap for XSLT template cache#1781
WW-5647 Use ConcurrentHashMap for XSLT template cache#1781arunmanni-ai wants to merge 2 commits into
Conversation
Code ReviewOverviewFixes a data race in The diagnosis is correct and the fix is sound. Concurrent read/write on a plain Correctness ✅Traced the
No regression in observable behavior; the only new effect is avoiding duplicate compilation on concurrent misses, which is the stated goal. Style / Conventions ✅
Suggestions / Minor Notes
SecurityThe underlying VerdictApprove. Small, correct, well-reasoned fix. The 🤖 Generated with Claude Code |
06cb3ed to
51e1d65
Compare
…oCache regression tests
51e1d65 to
33a5d7f
Compare
|
Hi @lukaszlenart , Addressed both optional follow-ups from your review:
Also added Full suite: |
The XSLT template cache in XSLTResult uses a plain HashMap with an unsynchronized get() outside the synchronized block. This can produce stale reads or internal corruption under concurrent access.
This patch:
getTemplates()no longer writes to the shared cache whennoCache=true, preventing a no-cache caller from polluting the cache for other callers.testConcurrentGetTemplatesCompilesOnce()andtestNoCacheDoesNotPollutePersistentCache()to cover the double-check dedup behavior and the noCache isolation fix.