ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpav...@apache.org
Subject ignite git commit: IGNITE-8430 implemented getCurrentCoordinatorFormatted method in IgniteMXBean - Fixes #3957.
Date Tue, 08 May 2018 14:12:42 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-2.5 111592e2c -> 7a3b2c88d


IGNITE-8430 implemented getCurrentCoordinatorFormatted method in IgniteMXBean - Fixes #3957.

Signed-off-by: dpavlov <dpavlov@apache.org>

(cherry picked from commit 666f220)


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

Branch: refs/heads/ignite-2.5
Commit: 7a3b2c88d13ef56f922a40cbe3fb9a550c0d6714
Parents: 111592e
Author: Anton Kalashnikov <kaa.dev@yandex.ru>
Authored: Tue May 8 17:10:53 2018 +0300
Committer: dpavlov <dpavlov@apache.org>
Committed: Tue May 8 17:12:41 2018 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    | 22 ++++++++++++++++++++
 .../org/apache/ignite/mxbean/IgniteMXBean.java  |  6 ++++++
 .../ignite/util/mbeans/GridMBeanSelfTest.java   | 16 +++++++++++---
 3 files changed, 41 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7a3b2c88/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 8305d4e..046c4b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -105,6 +105,7 @@ import org.apache.ignite.internal.binary.BinaryMarshaller;
 import org.apache.ignite.internal.binary.BinaryUtils;
 import org.apache.ignite.internal.cluster.ClusterGroupAdapter;
 import org.apache.ignite.internal.cluster.IgniteClusterEx;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.failure.FailureProcessor;
 import org.apache.ignite.internal.managers.GridManager;
 import org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager;
@@ -297,6 +298,9 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
     /** Force complete reconnect future. */
     private static final Object STOP_RECONNECT = new Object();
 
+    /** Separator for formatted coordinator properties. */
+    public static final String COORDINATOR_PROPERTIES_SEPARATOR = ",";
+
     static {
         LongJVMPauseDetector.start();
     }
@@ -503,6 +507,24 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
     }
 
     /** {@inheritDoc} */
+    @Override public String getCurrentCoordinatorFormatted() {
+        ClusterNode node = ctx.discovery().oldestAliveServerNode(AffinityTopologyVersion.NONE);
+
+        if (node == null)
+            return "";
+
+        return new StringBuilder()
+            .append(node.addresses())
+            .append(COORDINATOR_PROPERTIES_SEPARATOR)
+            .append(node.id())
+            .append(COORDINATOR_PROPERTIES_SEPARATOR)
+            .append(node.order())
+            .append(COORDINATOR_PROPERTIES_SEPARATOR)
+            .append(node.hostNames())
+            .toString();
+    }
+
+    /** {@inheritDoc} */
     @Override public String getCommunicationSpiFormatted() {
         assert cfg != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7a3b2c88/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
index 77ea035..cc4bc5b 100644
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/IgniteMXBean.java
@@ -433,6 +433,12 @@ public interface IgniteMXBean {
     public void dumpDebugInfo();
 
     /**
+     * Gets a formatted properties of current coordinator.
+     */
+    @MXBeanDescription("Formatted properties of current coordinator.")
+    public String getCurrentCoordinatorFormatted();
+
+    /**
      * Runs IO latency test against all remote server nodes in cluster.
      *
      * @param warmup Warmup duration in milliseconds.

http://git-wip-us.apache.org/repos/asf/ignite/blob/7a3b2c88/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanSelfTest.java
index 4f5ed19..4e329f9 100644
--- a/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/util/mbeans/GridMBeanSelfTest.java
@@ -22,6 +22,7 @@ import javax.management.MBeanInfo;
 import javax.management.MBeanOperationInfo;
 import javax.management.MBeanParameterInfo;
 import javax.management.StandardMBean;
+import org.apache.ignite.internal.IgniteEx;
 import org.apache.ignite.internal.mxbean.IgniteStandardMXBean;
 import org.apache.ignite.mxbean.IgniteMXBean;
 import org.apache.ignite.mxbean.MXBeanDescription;
@@ -161,10 +162,19 @@ public class GridMBeanSelfTest extends GridCommonAbstractTest {
      */
     public void testIgniteKernalReturnsValidMBeanInfo() throws Exception {
         try {
-            IgniteMXBean ignite = (IgniteMXBean)startGrid();
+            IgniteEx igniteCrd = startGrid(0);
 
-            assertNotNull(ignite.getUserAttributesFormatted());
-            assertNotNull(ignite.getLifecycleBeansFormatted());
+            IgniteMXBean igniteMXBean = (IgniteMXBean)startGrid(1);
+
+            assertNotNull(igniteMXBean.getUserAttributesFormatted());
+            assertNotNull(igniteMXBean.getLifecycleBeansFormatted());
+
+            String coordinatorFormatted = igniteMXBean.getCurrentCoordinatorFormatted();
+
+            assertTrue(coordinatorFormatted.contains(igniteCrd.localNode().addresses().toString()));
+            assertTrue(coordinatorFormatted.contains(igniteCrd.localNode().hostNames().toString()));
+            assertTrue(coordinatorFormatted.contains(Long.toString(igniteCrd.localNode().order())));
+            assertTrue(coordinatorFormatted.contains(igniteCrd.localNode().id().toString()));
         }
         finally {
             stopAllGrids();


Mime
View raw message