ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject incubator-ignite git commit: GG-10576 Start Visor in client mode.
Date Fri, 17 Jul 2015 08:28:02 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-gg-10576 [created] 34f30746f


GG-10576 Start Visor in client mode.


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

Branch: refs/heads/ignite-gg-10576
Commit: 34f30746f48f1e3593b5cad8cf0499cbd7a753eb
Parents: 44043fa
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Fri Jul 17 15:27:54 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Fri Jul 17 15:27:54 2015 +0700

----------------------------------------------------------------------
 .../ignite/internal/visor/util/VisorTaskUtils.java     |  9 +++++++++
 .../ignite/visor/commands/open/VisorOpenCommand.scala  | 13 +++++++++++++
 2 files changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/34f30746/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index 6636a08..d98fc09 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -871,4 +871,13 @@ public class VisorTaskUtils {
 
         return bos.toByteArray();
     }
+
+    /**
+     *
+     * @param msg Exception message.
+     * @return {@code true} if node failed to join grid.
+     */
+    public static boolean joinTimedOut(String msg) {
+        return msg.startsWith("Join process timed out.");
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/34f30746/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
index 632a96b..2f20cc4 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/open/VisorOpenCommand.scala
@@ -25,9 +25,13 @@ import org.apache.ignite.internal.IgniteComponentType._
 import org.apache.ignite.internal.IgniteEx
 import org.apache.ignite.internal.util.scala.impl
 import org.apache.ignite.internal.util.spring.IgniteSpringHelper
+import org.apache.ignite.internal.util.typedef.X
 import org.apache.ignite.internal.util.{IgniteUtils => U}
+import org.apache.ignite.internal.visor.util.VisorTaskUtils._
 import org.apache.ignite.logger.NullLogger
+import org.apache.ignite.spi.IgniteSpiException
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi
 import org.apache.ignite.visor.commands.common.{VisorConsoleCommand, VisorTextTable}
 import org.apache.ignite.visor.visor._
 import org.apache.ignite.visor.{VisorTag, visor}
@@ -230,6 +234,10 @@ class VisorOpenCommand extends VisorConsoleCommand {
 
         val shutdownHook = IgniteSystemProperties.getString(IGNITE_NO_SHUTDOWN_HOOK, "false")
 
+        // Make sure visor starts in client mode.
+        cfg.setClientMode(true)
+        cfg.getDiscoverySpi.asInstanceOf[TcpDiscoverySpi].setJoinTimeout(10000)
+
         // Make sure Visor console starts as daemon node.
         Ignition.setDaemon(true)
 
@@ -255,6 +263,11 @@ class VisorOpenCommand extends VisorConsoleCommand {
             catch {
                 case _: IllegalStateException =>
                     throw new IgniteException("Named grid unavailable: " + startedGridName)
+                case e: Throwable =>
+                    if (X.hasCause(e, classOf[IgniteSpiException]) && joinTimedOut(X.cause(e,
classOf[IgniteSpiException]).getMessage))
+                        throw new IgniteException("Visor console failed to connect to any
of server nodes", e)
+                    else
+                        throw e
             }
 
         visor.open(startedGridName, cfgPath)


Mime
View raw message