HDFS-13990. Synchronization Issue With HashResolver. Contributed by BELUGA BEHR.

This commit is contained in:
Inigo Goiri 2018-10-18 10:05:27 -07:00
parent ba7e81667c
commit 1e78dfca40

View File

@ -98,13 +98,9 @@ public String getFirstNamespace(final String path, final PathLocation loc) {
* namespaces using the provided set of namespace identifiers.
*/
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;
final int hash = namespaces.hashCode();
return this.hashResolverMap.computeIfAbsent(hash,
k -> new ConsistentHashRing(namespaces));
}
/**