You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by xy...@apache.org on 2018/10/19 20:18:50 UTC

[08/50] [abbrv] hadoop git commit: HDFS-13990. Synchronization Issue With HashResolver. Contributed by BELUGA BEHR.

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


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1e78dfca
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1e78dfca
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1e78dfca

Branch: refs/heads/HDDS-4
Commit: 1e78dfca40ed2242bf7785e6f23672c40931bf79
Parents: ba7e816
Author: Inigo Goiri <in...@apache.org>
Authored: Thu Oct 18 10:05:27 2018 -0700
Committer: Inigo Goiri <in...@apache.org>
Committed: Thu Oct 18 10:05:27 2018 -0700

----------------------------------------------------------------------
 .../server/federation/resolver/order/HashResolver.java    | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/1e78dfca/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/HashResolver.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/HashResolver.java b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/HashResolver.java
index 4034a46..455a3ed 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/HashResolver.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/order/HashResolver.java
@@ -98,13 +98,9 @@ public class HashResolver implements OrderedResolver {
    *         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));
   }
 
   /**


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org