Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
3.2.0
-
None
-
Reviewed
Description
HashResolver.java
private ConsistentHashRing getHashResolver(final Set<String> namespaces) { int hash = namespaces.hashCode(); ConsistentHashRing resolver = this.hashResolverMap.get(hash); if (resolver == null) { resolver = new ConsistentHashRing(namespaces); this.hashResolverMap.put(hash, resolver); } return resolver; }
The hashResolverMap is a ConcurrentHashMap so presumably there is concern here for concurrency issues. However, there is no synchronization around this method, so two threads could call get(hash) both see a 'null' value and then both add two entries into the Map. Add synchronization here.