You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2020/10/21 14:33:13 UTC

[GitHub] [accumulo] milleruntime commented on a change in pull request #1744: Use newer map methods in TabletGroupWatcher

milleruntime commented on a change in pull request #1744:
URL: https://github.com/apache/accumulo/pull/1744#discussion_r509340450



##########
File path: server/manager/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
##########
@@ -214,14 +214,8 @@ public void run() {
           TableId tableId = tls.extent.tableId();
           TableConfiguration tableConf = this.master.getContext().getTableConfiguration(tableId);
 
-          MergeStats mergeStats = mergeStatsCache.get(tableId);
-          if (mergeStats == null) {
-            mergeStats = currentMerges.get(tableId);
-            if (mergeStats == null) {
-              mergeStats = new MergeStats(new MergeInfo());
-            }
-            mergeStatsCache.put(tableId, mergeStats);
-          }
+          MergeStats mergeStats = mergeStatsCache.computeIfAbsent(tableId,
+              k -> currentMerges.getOrDefault(k, new MergeStats(new MergeInfo())));

Review comment:
       Now you got me thinking, how does ```map.getOrDefault(k, new MergeInfo())``` behave differently from ```log.debug("Merge: {}", new MergeInfo())```?  Does slf4j have a special ability to not call the method on the interface based on logging level vs the default method on the Map interface, which will always execute the method?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org