cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject [2/6] git commit: FD exposes a count of up/down machines over JMX Patch by Sankalp Kohli, reviewed by brandonwilliams for CASSANDRA-6044
Date Tue, 08 Oct 2013 10:28:51 GMT
FD exposes a count of up/down machines over JMX
Patch by Sankalp Kohli, reviewed by brandonwilliams for CASSANDRA-6044


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

Branch: refs/heads/cassandra-2.0
Commit: fe56518d94bb53cf931a4700d9c5e4e56fc6f703
Parents: 6a54340
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Tue Oct 8 05:27:02 2013 -0500
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Tue Oct 8 05:27:02 2013 -0500

----------------------------------------------------------------------
 .../apache/cassandra/gms/FailureDetector.java   | 22 ++++++++++++++++++++
 .../cassandra/gms/FailureDetectorMBean.java     |  4 ++++
 2 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/fe56518d/src/java/org/apache/cassandra/gms/FailureDetector.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/FailureDetector.java b/src/java/org/apache/cassandra/gms/FailureDetector.java
index 2b3905a..26d78ab 100644
--- a/src/java/org/apache/cassandra/gms/FailureDetector.java
+++ b/src/java/org/apache/cassandra/gms/FailureDetector.java
@@ -90,6 +90,28 @@ public class FailureDetector implements IFailureDetector, FailureDetectorMBean
         return nodesStatus;
     }
 
+    public int getDownEndpointCount()
+    {
+        int count = 0;
+        for (Map.Entry<InetAddress, EndpointState> entry : Gossiper.instance.endpointStateMap.entrySet())
+        {
+            if (!entry.getValue().isAlive())
+                count++;
+        }
+        return count;
+    }
+
+    public int getUpEndpointCount()
+    {
+        int count = 0;
+        for (Map.Entry<InetAddress, EndpointState> entry : Gossiper.instance.endpointStateMap.entrySet())
+        {
+            if (entry.getValue().isAlive())
+                count++;
+        }
+        return count;
+    }
+
     public String getEndpointState(String address) throws UnknownHostException
     {
         StringBuilder sb = new StringBuilder();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fe56518d/src/java/org/apache/cassandra/gms/FailureDetectorMBean.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/gms/FailureDetectorMBean.java b/src/java/org/apache/cassandra/gms/FailureDetectorMBean.java
index 3b04c9f..45250b4 100644
--- a/src/java/org/apache/cassandra/gms/FailureDetectorMBean.java
+++ b/src/java/org/apache/cassandra/gms/FailureDetectorMBean.java
@@ -33,4 +33,8 @@ public interface FailureDetectorMBean
     public String getEndpointState(String address) throws UnknownHostException;
 
     public Map<String, String> getSimpleStates();
+
+    public int getDownEndpointCount();
+
+    public int getUpEndpointCount();
 }


Mime
View raw message