cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject cassandra git commit: use Collections.emptyMap() to more clearly document that that case is a no-op operation
Date Fri, 22 Jul 2016 23:16:17 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk be24013bd -> 52c81d7b6


use Collections.emptyMap() to more clearly document that that case is a no-op operation


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/52c81d7b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/52c81d7b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/52c81d7b

Branch: refs/heads/trunk
Commit: 52c81d7b62f4923914fda1d4db1f536d6d0ab477
Parents: be24013
Author: Dave Brosius <dbrosius@mebigfatguy.com>
Authored: Fri Jul 22 19:15:59 2016 -0400
Committer: Dave Brosius <dbrosius@mebigfatguy.com>
Committed: Fri Jul 22 19:15:59 2016 -0400

----------------------------------------------------------------------
 .../apache/cassandra/tools/nodetool/stats/TpStatsPrinter.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/52c81d7b/src/java/org/apache/cassandra/tools/nodetool/stats/TpStatsPrinter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/nodetool/stats/TpStatsPrinter.java b/src/java/org/apache/cassandra/tools/nodetool/stats/TpStatsPrinter.java
index 48f538b..b874746 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/stats/TpStatsPrinter.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/stats/TpStatsPrinter.java
@@ -19,6 +19,7 @@
 package org.apache.cassandra.tools.nodetool.stats;
 
 import java.io.PrintStream;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -47,10 +48,10 @@ public class TpStatsPrinter
 
             out.printf("%-30s%10s%10s%15s%10s%18s%n", "Pool Name", "Active", "Pending", "Completed",
"Blocked", "All time blocked");
 
-            Map<Object, Object> threadPools = convertData.get("ThreadPools") instanceof
HashMap<?, ?> ? (HashMap)convertData.get("ThreadPools") : new HashMap();
+            Map<Object, Object> threadPools = convertData.get("ThreadPools") instanceof
Map<?, ?> ? (Map)convertData.get("ThreadPools") : Collections.emptyMap();
             for (Map.Entry<Object, Object> entry : threadPools.entrySet())
             {
-                HashMap values = entry.getValue() instanceof HashMap<?, ?> ? (HashMap)entry.getValue()
: new HashMap();
+                Map values = entry.getValue() instanceof Map<?, ?> ? (Map)entry.getValue()
: Collections.emptyMap();
                 out.printf("%-30s%10s%10s%15s%10s%18s%n",
                            entry.getKey(),
                            values.get("ActiveTasks"),
@@ -62,7 +63,7 @@ public class TpStatsPrinter
 
             out.printf("%n%-20s%10s%n", "Message type", "Dropped");
 
-            Map<Object, Object> droppedMessages = convertData.get("DroppedMessage")
instanceof HashMap<?, ?> ? (HashMap)convertData.get("DroppedMessage") : new HashMap();
+            Map<Object, Object> droppedMessages = convertData.get("DroppedMessage")
instanceof Map<?, ?> ? (Map)convertData.get("DroppedMessage") : Collections.emptyMap();
             for (Map.Entry<Object, Object> entry : droppedMessages.entrySet())
             {
                 out.printf("%-20s%10s%n", entry.getKey(), entry.getValue());


Mime
View raw message