uap-java
uap-java copied to clipboard
CachingParser is not thread safe
The class CachingParser
uses a org.apache.commons.collections4.map.LRUMap
internally.
The JavaDoc clearly states:
Note that LRUMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization. The simplest approach is to wrap this map using Collections.synchronizedMap(Map). This class may throw NullPointerException's when accessed by concurrent threads.
I think it would be good to add a lock directly in the CachingParser
.
related: https://github.com/ua-parser/uap-java/pull/24
This would be appreciated. 👍