I found the Cache created by method “CacheFactory.createCache(String name)” in UsernaMager Component is not synchronized, because it is implemented by HashMap.
If multiple threads access this Cache concurrently, and at least one of the threads modifies it structurally, thread safety issues will happen. So, how does author consider this problem? Otherwise, my understanding to the source code is not correct.
@Tom Evans@Gaston Dombiak@girishkumarThe specified item was not found.@snowingximenOpenfire Dev@
I got the answer in interface Cache from source code, they using synchronized keyword in get and put method even though in latest version 4.0.x.Why don’t they use ConcurrentHashMap?@Tom Evans
This cache was implemented in year 2004.
ConcurrentHashmap came with Java 5 (30. Sep. 2004).
Although it’s same year, it’s likely that Openfire was required to run with Java 4, therefore no ConcurrentHashmap.
Not so, source code also contains ConcurrentHashMap, thanks for your reply.
Seems like CacheFactory has been developed later. First git commit dates to 2007. DefaultCache is 2004.