lukaszlenart opened a new pull request, #1903:
URL: https://github.com/apache/struts/pull/1903

   6.x backport of #1902.
   
   The Tiles definition caches are keyed by the resolved `Locale`, which by 
default derives from the request. Two maps grew without limit and were never 
reduced for the lifetime of the web application:
   
   - `CachingLocaleUrlDefinitionDAO#locale2definitionMap` — populated on each 
cache miss, only cleared under the (default-off) `checkRefresh` path.
   - `AbstractPatternDefinitionResolver#localePatternPaths` — populated via 
`computeIfAbsent` per locale key, never swept.
   
   ### Change
   
   - Bound `locale2definitionMap` with an insertion-order `LinkedHashMap` 
capped at `maxCachedLocales` (default `1000`, configurable via 
`setMaxCachedLocales`). Insertion-order keeps the existing unsynchronized 
`getDefinitions` read unchanged.
   - On eviction the DAO removes the same key from the pattern resolver through 
the new `PatternDefinitionResolver#removePatternPaths`, keeping both maps in 
lockstep — the resolver's keys are always a subset of the DAO's.
   - `localePatternPaths` becomes a `ConcurrentHashMap`, as the DAO now removes 
keys off the request thread.
   
   Eviction only re-incurs a load on next access; it never changes rendering. 
The code is Java 8 compatible (explicit type arguments on the bounded map). The 
full `struts2-tiles-plugin` module suite passes (547 tests) under the Java 8 
release level.
   
   Fixes [WW-5716](https://issues.apache.org/jira/browse/WW-5716)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to