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 16:45:59 UTC

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

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



##########
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:
       With log4j 2 - it appears that lambdas can be used to provide lazy behavior.
   `log.debug("debug called: {}", () -> expensiveCall());`
   Would avoid the call if debug level logging was not enabled.




----------------------------------------------------------------
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