Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Remove synchronization from ResourceBundleMessageSource [SPR-16235] #20782
The ResourceBundleMessageSource class caches the properties to HashMaps by default and
Here is the stack trace, notice the first line is holding lock on a hashmap, which is the hashmap that holds properties:
Because in major case, these hashmaps are ready-heavy and entries of these hashmaps will not be purged. To improve this, want to use a concurrent hashmap.
Here is the patch, jmh benchamrk and benchmark results.
As you can see, if my change is correct, using ConcurrentHashMap is 5~6X faster than large synchronization block.
Affects: 4.3.12, 5.0.1
Reference URL: https://github.com/imasahiro/spring-issue