ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [20/24] ignite git commit: ignite-1.5 Avoid NPE in dumpDebugInfo.
Date Thu, 17 Dec 2015 09:42:10 GMT
ignite-1.5 Avoid NPE in dumpDebugInfo.


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

Branch: refs/heads/ignite-1.5.1
Commit: 5f26538d7ac7838500259e9213abf26db50da9d9
Parents: 7f35bc6
Author: sboikov <sboikov@gridgain.com>
Authored: Thu Dec 17 11:58:32 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu Dec 17 11:58:32 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    | 35 ++++++++++++--------
 1 file changed, 21 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5f26538d/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 e0503fa..6e0be10 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
@@ -3245,26 +3245,33 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
 
     /** {@inheritDoc} */
     public void dumpDebugInfo() {
-        GridKernalContextImpl ctx = this.ctx;
+        try {
+            GridKernalContextImpl ctx = this.ctx;
+
+            GridDiscoveryManager discoMrg = ctx != null ? ctx.discovery() : null;
 
-        if (ctx != null) {
-            boolean client = ctx.clientNode();
+            ClusterNode locNode = discoMrg != null ? discoMrg.localNode() : null;
 
-            ClusterNode locNode = ctx.discovery().localNode();
+            if (ctx != null && discoMrg != null && locNode != null) {
+                boolean client = ctx.clientNode();
 
-            UUID routerId = locNode instanceof TcpDiscoveryNode ? ((TcpDiscoveryNode)locNode).clientRouterNodeId()
: null;
+                UUID routerId = locNode instanceof TcpDiscoveryNode ? ((TcpDiscoveryNode)locNode).clientRouterNodeId()
: null;
 
-            U.warn(log, "Dumping debug info for node [id=" + locNode.id() +
-                ", name=" + ctx.gridName() +
-                ", order=" + locNode.order() +
-                ", topVer=" + ctx.discovery().topologyVersion() +
-                ", client=" + client +
-                (client && routerId != null ? ", routerId=" + routerId : "") + ']');
+                U.warn(log, "Dumping debug info for node [id=" + locNode.id() +
+                    ", name=" + ctx.gridName() +
+                    ", order=" + locNode.order() +
+                    ", topVer=" + discoMrg.topologyVersion() +
+                    ", client=" + client +
+                    (client && routerId != null ? ", routerId=" + routerId : "")
+ ']');
 
-            ctx.cache().context().exchange().dumpDebugInfo();
+                ctx.cache().context().exchange().dumpDebugInfo();
+            }
+            else
+                U.warn(log, "Dumping debug info for node, context is not initialized [name="
+ gridName + ']');
+        }
+        catch (Exception e) {
+            U.error(log, "Failed to dump debug info for node: " + e, e);
         }
-        else
-            U.warn(log, "Dumping debug info for node, context is not initialized [name="
+ gridName + ']');
     }
 
     /** {@inheritDoc} */


Mime
View raw message