Repository navigation
Conversation
…safe The static cache was a lazily created HashMap guarded by a synchronized instance method, so concurrent renders did not share the lock. It is now a static final ConcurrentHashMap, as in WW-5647 for XSLTResult.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes WW-5831
Hardening, no behaviour change.
BeanAdapter.propertyDescriptorCacheis a static, lazily createdHashMapguarded by asynchronizedinstance method. Each render creates its ownBeanAdapter, so the lock is never shared. It is now astatic final ConcurrentHashMap, and the lazy-init block andsynchronizedare removed. Same approach as WW-5647 (#1781) forXSLTResult.templatesCache.BeanAdapterTest#testConcurrentAdaptersCacheEachBeanClassOncehas 16 threads fetch descriptors for 4,095 distinct bean classes and asserts exactly 4,095 entries were added. Without the change it failed 28/28 runs, with the cache size above the class count by a varying amount (observed 4100 to 4114 in 28 runs; it varies per run). With the change it passed 20/20.The test is statistical: it can pass without the fix on a fast machine (an earlier 500-class variant did in some runs), but it never fails with the fix. The classes are
java.lang.reflect.Proxyclasses over every non-empty subset of 12 JDK interfaces, all in the test class loader, so no class loaders are created.Not changed: no bound is added to the cache. Not claiming a security issue or data exposure; only the corrupted map size was measured. The matching
ScopeInterceptorchange is #2082.xslt plugin module on the rebased branch (clean build): 18 tests, 0 failures. With only the production change reverted,
BeanAdapterTestfails.