Repository: incubator-ignite Updated Branches: refs/heads/ignite-55-2 [created] e8d4d6e8f
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/db09278d/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala index aafee99..ba5f460 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/gc/VisorGcCommand.scala @@ -129,7 +129,7 @@ class VisorGcCommand { } else if (id.isDefined) try { - node = grid.node(UUID.fromString(id.get)) + node = ignite.node(UUID.fromString(id.get)) if (node == null) scold("'id' does not match any node: " + id.get).^^ @@ -143,13 +143,13 @@ class VisorGcCommand { t #= ("Node ID8(@)", "Free Heap Before", "Free Heap After", "Free Heap Delta") - val prj = grid.forRemotes() + val prj = ignite.forRemotes() val nids = prj.nodes().map(_.id()) val NULL: Void = null - grid.compute(prj).withNoFailover().execute(classOf[VisorNodeGcTask], + ignite.compute(prj).withNoFailover().execute(classOf[VisorNodeGcTask], toTaskArgument(nids, NULL)).foreach { case (nid, stat) => val roundHb = stat.get1() / (1024L * 1024L) val roundHa = stat.get2() / (1024L * 1024L) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/db09278d/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/kill/VisorKillCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/kill/VisorKillCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/kill/VisorKillCommand.scala index b097791..c3a1bf9 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/kill/VisorKillCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/kill/VisorKillCommand.scala @@ -162,7 +162,7 @@ class VisorKillCommand { } else if (id.isDefined) try { - node = grid.node(java.util.UUID.fromString(id.get)) + node = ignite.node(java.util.UUID.fromString(id.get)) if (node == null) scold("'id' does not match any node : " + args).^^ @@ -185,7 +185,7 @@ class VisorKillCommand { val op = if (restart) "restart" else "kill" try - killOrRestart(if (node == null) grid.nodes().map(_.id()) else Collections.singleton(node.id()), restart) + killOrRestart(if (node == null) ignite.nodes().map(_.id()) else Collections.singleton(node.id()), restart) catch { case _: IgniteException => scold("Failed to " + op + " due to system error.").^^ } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/db09278d/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala index d9d7ab9..b74c0f5 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/node/VisorNodeCommand.scala @@ -151,7 +151,7 @@ class VisorNodeCommand { } else if (id.isDefined) try - node = grid.node(UUID.fromString(id.get)) + node = ignite.node(UUID.fromString(id.get)) catch { case e: IllegalArgumentException => warn("Invalid node ID: " + id.get).^^ } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/db09278d/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ping/VisorPingCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ping/VisorPingCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ping/VisorPingCommand.scala index 65545f0..f8b0608 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ping/VisorPingCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/ping/VisorPingCommand.scala @@ -54,7 +54,7 @@ private case class Pinger(n: ClusterNode, res: Result) extends Runnable { assert(res != null) override def run() { - val ok = grid.pingNode(n.id()) + val ok = ignite.pingNode(n.id()) res.synchronized { res.total += 1 @@ -133,7 +133,7 @@ class VisorPingCommand { var pings = List.empty[Pinger] if (argLst.isEmpty) - pings ++= grid.nodes().map(Pinger(_, res)) + pings ++= ignite.nodes().map(Pinger(_, res)) else { for (id8 <- argLst) { if (id8._1 != null || id8._2 == null) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/db09278d/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala index 4612775..83c71ef 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/start/VisorStartCommand.scala @@ -229,7 +229,7 @@ class VisorStartCommand { scold("File is a directory: " + file.getAbsolutePath).^^ try - res = grid.startNodes(file, restart, timeout, maxConn).map(t => { + res = ignite.startNodes(file, restart, timeout, maxConn).map(t => { Result(t.get1, t.get2, t.get3) }).toSeq catch { @@ -285,7 +285,7 @@ class VisorStartCommand { ) try - res = grid.startNodes(asJavaCollection(Seq(params)), null, restart, timeout, maxConn). + res = ignite.startNodes(asJavaCollection(Seq(params)), null, restart, timeout, maxConn). map(t => Result(t.get1, t.get2, t.get3)).toSeq catch { case e: IgniteException => scold(e.getMessage).^^ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/db09278d/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala index 20f121a..2cd532e 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommand.scala @@ -623,9 +623,9 @@ class VisorTasksCommand { private def list(p: Long, taskName: String, reverse: Boolean, all: Boolean) { breakable { try { - val prj = grid.forRemotes() + val prj = ignite.forRemotes() - val evts = grid.compute(prj).execute(classOf[VisorNodeEventsCollectorTask], + val evts = ignite.compute(prj).execute(classOf[VisorNodeEventsCollectorTask], toTaskArgument(prj.nodes.map(_.id()), VisorNodeEventsCollectorTaskArg.createTasksArg(p, taskName, null))) val (tLst, eLst) = mkData(evts) @@ -831,9 +831,9 @@ class VisorTasksCommand { assert(taskName != null) try { - val prj = grid.forRemotes() + val prj = ignite.forRemotes() - val evts = grid.compute(prj).execute(classOf[VisorNodeEventsCollectorTask], toTaskArgument(prj.nodes.map(_.id()), + val evts = ignite.compute(prj).execute(classOf[VisorNodeEventsCollectorTask], toTaskArgument(prj.nodes.map(_.id()), VisorNodeEventsCollectorTaskArg.createTasksArg(null, taskName, null))) val (tLst, eLst) = mkData(evts) @@ -1008,9 +1008,9 @@ class VisorTasksCommand { } try { - val prj = grid.forRemotes() + val prj = ignite.forRemotes() - val evts = grid.compute(prj).execute(classOf[VisorNodeEventsCollectorTask], toTaskArgument(prj.nodes.map(_.id()), + val evts = ignite.compute(prj).execute(classOf[VisorNodeEventsCollectorTask], toTaskArgument(prj.nodes.map(_.id()), VisorNodeEventsCollectorTaskArg.createTasksArg(null, null, uuid))) val (tLst, eLst) = mkData(evts) @@ -1126,9 +1126,9 @@ class VisorTasksCommand { private def nodes(f: Long) { breakable { try { - val prj = grid.forRemotes() + val prj = ignite.forRemotes() - val evts = grid.compute(prj).execute(classOf[VisorNodeEventsCollectorTask], toTaskArgument(prj.nodes.map(_.id()), + val evts = ignite.compute(prj).execute(classOf[VisorNodeEventsCollectorTask], toTaskArgument(prj.nodes.map(_.id()), VisorNodeEventsCollectorTaskArg.createTasksArg(f, null, null))) val eLst = mkData(evts)._2 @@ -1238,9 +1238,9 @@ class VisorTasksCommand { private def hosts(f: Long) { breakable { try { - val prj = grid.forRemotes() + val prj = ignite.forRemotes() - val evts = grid.compute(prj).execute(classOf[VisorNodeEventsCollectorTask], toTaskArgument(prj.nodes.map(_.id()), + val evts = ignite.compute(prj).execute(classOf[VisorNodeEventsCollectorTask], toTaskArgument(prj.nodes.map(_.id()), VisorNodeEventsCollectorTaskArg.createTasksArg(f, null, null))) val eLst = mkData(evts)._2 @@ -1255,7 +1255,7 @@ class VisorTasksCommand { eLst.foreach(e => { e.nodeIds.foreach(id => { - val host = grid.node(id).addresses.headOption + val host = ignite.node(id).addresses.headOption if (host.isDefined) { var eSet = hMap.getOrElse(host.get, Set.empty[VisorExecution]) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/db09278d/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala index 87f2ee7..afbd932 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/top/VisorTopologyCommand.scala @@ -227,7 +227,7 @@ class VisorTopologyCommand { assert(f != null) assert(hosts != null) - var nodes = grid.forPredicate(new IgnitePredicate[ClusterNode] { + var nodes = ignite.forPredicate(new IgnitePredicate[ClusterNode] { override def apply(e: ClusterNode) = f(e) }).nodes() @@ -329,15 +329,15 @@ class VisorTopologyCommand { nl() - val m = grid.forNodes(nodes).metrics() + val m = ignite.forNodes(nodes).metrics() val freeHeap = (m.getHeapMemoryMaximum - m.getHeapMemoryUsed) * 100 / m.getHeapMemoryMaximum val sumT = VisorTextTable() - sumT += ("Total hosts", IgniteUtils.neighborhood(grid.nodes()).size) - sumT += ("Total nodes", grid.nodes().size) + sumT += ("Total hosts", IgniteUtils.neighborhood(ignite.nodes()).size) + sumT += ("Total nodes", ignite.nodes().size) sumT += ("Total CPUs", m.getTotalCpus) sumT += ("Avg. CPU load", safePercent(m.getAverageCpuLoad * 100)) sumT += ("Avg. free heap", formatDouble(freeHeap) + " %") http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/db09278d/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala index 6edf895..1e72769 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/vvm/VisorVvmCommand.scala @@ -166,7 +166,7 @@ class VisorVvmCommand { if (id8 != null && id != null) scold("Only one of '-id8' or '-id' is allowed.").^^ else if (id8 == null && id == null) - nodes = grid.forRemotes().nodes().toSeq + nodes = ignite.forRemotes().nodes().toSeq else if (id8 != null) { val ns = nodeById8(id8) @@ -180,7 +180,7 @@ class VisorVvmCommand { } else if (id != null) try { - val node = grid.node(java.util.UUID.fromString(id)) + val node = ignite.node(java.util.UUID.fromString(id)) if (node == null) scold("'id' does not match any node: " + id).^^ @@ -193,7 +193,7 @@ class VisorVvmCommand { var started = false - val neighbors = grid.forHost(grid.localNode).nodes() + val neighbors = ignite.forHost(ignite.localNode).nodes() if (IgniteUtils.isWindows) vvmCmd = "cmd /c \"%s\"".format(vvmCmd) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/db09278d/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala index b8c51a1..fac50aa 100644 --- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala +++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/visor.scala @@ -227,7 +227,7 @@ object visor extends VisorTag { @volatile var cfgPath: String = null /** */ - @volatile var grid: IgniteEx = null + @volatile var ignite: IgniteEx = null /** * Get grid node for specified ID. @@ -237,7 +237,7 @@ object visor extends VisorTag { * @throws IgniteException if Visor is disconnected or node not found. */ def node(nid: UUID): ClusterNode = { - val g = grid + val g = ignite if (g == null) throw new IgniteException("Visor disconnected") @@ -254,7 +254,7 @@ object visor extends VisorTag { Runtime.getRuntime.addShutdownHook(new Thread() { override def run() { try - if (grid != null && isConnected) { + if (ignite != null && isConnected) { // Call all shutdown callbacks. shutdownCbs foreach(_.apply()) @@ -851,7 +851,7 @@ object visor extends VisorTag { } else if (id.isDefined) try { - val node = Option(grid.node(java.util.UUID.fromString(id.get))) + val node = Option(ignite.node(java.util.UUID.fromString(id.get))) if (node.isDefined) Right(node) @@ -1257,7 +1257,7 @@ object visor extends VisorTag { * Gets global projection as an option. */ def gridOpt = - Option(grid) + Option(ignite) def noop() {} @@ -1289,10 +1289,10 @@ object visor extends VisorTag { t += ("Status", if (isCon) "Connected" else "Disconnected") t += ("Grid name", - if (grid == null) + if (ignite == null) "<n/a>" else { - val n = grid.name + val n = ignite.name if (n == null) "<default>" else n } @@ -1598,7 +1598,7 @@ object visor extends VisorTag { this.cfgPath = cfgPath - grid = + ignite = try Ignition.ignite(startedGridName).asInstanceOf[IgniteEx] catch { @@ -1614,7 +1614,7 @@ object visor extends VisorTag { conOwner = true conTs = System.currentTimeMillis - grid.nodes().foreach(n => { + ignite.nodes().foreach(n => { setVarIfAbsent(nid8(n), "n") val ip = n.addresses().headOption @@ -1629,7 +1629,7 @@ object visor extends VisorTag { case de: DiscoveryEvent => setVarIfAbsent(nid8(de.eventNode()), "n") - val node = grid.node(de.eventNode().id()) + val node = ignite.node(de.eventNode().id()) if (node != null) { val ip = node.addresses().headOption @@ -1650,7 +1650,7 @@ object visor extends VisorTag { } } - grid.events().localListen(nodeJoinLsnr, EVT_NODE_JOINED) + ignite.events().localListen(nodeJoinLsnr, EVT_NODE_JOINED) nodeLeftLsnr = new IgnitePredicate[Event]() { override def apply(e: Event): Boolean = { @@ -1664,7 +1664,7 @@ object visor extends VisorTag { val ip = de.eventNode().addresses.headOption if (ip.isDefined) { - val last = !grid.nodes().exists(n => + val last = !ignite.nodes().exists(n => n.addresses.size > 0 && n.addresses.head == ip.get ) @@ -1681,13 +1681,13 @@ object visor extends VisorTag { } } - grid.events().localListen(nodeLeftLsnr, EVT_NODE_LEFT, EVT_NODE_FAILED) + ignite.events().localListen(nodeLeftLsnr, EVT_NODE_LEFT, EVT_NODE_FAILED) nodeSegLsnr = new IgnitePredicate[Event] { override def apply(e: Event): Boolean = { e match { case de: DiscoveryEvent => - if (de.eventNode().id() == grid.localNode.id) { + if (de.eventNode().id() == ignite.localNode.id) { warn("Closing Visor console due to topology segmentation.") warn("Contact your system administrator.") @@ -1701,11 +1701,11 @@ object visor extends VisorTag { } } - grid.events().localListen(nodeSegLsnr, EVT_NODE_SEGMENTED) + ignite.events().localListen(nodeSegLsnr, EVT_NODE_SEGMENTED) nodeStopLsnr = new IgnitionListener { def onStateChange(name: String, state: IgniteState) { - if (name == grid.name && state == IgniteState.STOPPED) { + if (name == ignite.name && state == IgniteState.STOPPED) { warn("Closing Visor console due to stopping of host grid instance.") nl() @@ -1763,12 +1763,12 @@ object visor extends VisorTag { assert(id != null) assert(isCon) - val g = grid + val g = ignite if (g != null && g.localNode.id == id) "<visor>" else { - val n = grid.node(id) + val n = ignite.node(id) val id8 = nid8(id) val v = mfind(id8) @@ -1836,7 +1836,7 @@ object visor extends VisorTag { t #= ("#", "Node ID8(@), IP", "Up Time", "CPUs", "CPU Load", "Free Heap") - val nodes = grid.nodes().toList + val nodes = ignite.nodes().toList if (nodes.isEmpty) { warn("Topology is empty.") @@ -1900,7 +1900,7 @@ object visor extends VisorTag { t #= ("#", "Int./Ext. IPs", "Node ID8(@)", "OS", "CPUs", "MACs", "CPU Load") - val neighborhood = IgniteUtils.neighborhood(grid.nodes()).values().toIndexedSeq + val neighborhood = IgniteUtils.neighborhood(ignite.nodes()).values().toIndexedSeq if (neighborhood.isEmpty) { warn("Topology is empty.") @@ -1958,7 +1958,7 @@ object visor extends VisorTag { None else { try - Some(grid.forNodes(neighborhood(a.toInt))) + Some(ignite.forNodes(neighborhood(a.toInt))) catch { case e: Throwable => warn("Invalid selection: " + a) @@ -2059,7 +2059,7 @@ object visor extends VisorTag { def askNodeId(): Option[String] = { assert(isConnected) - val ids = grid.forRemotes().nodes().map(nid8).toList + val ids = ignite.forRemotes().nodes().map(nid8).toList (0 until ids.size).foreach(i => println((i + 1) + ": " + ids(i))) @@ -2160,23 +2160,23 @@ object visor extends VisorTag { // Call all close callbacks. cbs foreach(_.apply()) - if (grid != null && Ignition.state(grid.name) == IgniteState.STARTED) { + if (ignite != null && Ignition.state(ignite.name) == IgniteState.STARTED) { if (nodeJoinLsnr != null) - grid.events().stopLocalListen(nodeJoinLsnr) + ignite.events().stopLocalListen(nodeJoinLsnr) if (nodeLeftLsnr != null) - grid.events().stopLocalListen(nodeLeftLsnr) + ignite.events().stopLocalListen(nodeLeftLsnr) if (nodeSegLsnr != null) - grid.events().stopLocalListen(nodeSegLsnr) + ignite.events().stopLocalListen(nodeSegLsnr) } if (nodeStopLsnr != null) Ignition.removeListener(nodeStopLsnr) - if (grid != null && conOwner) + if (ignite != null && conOwner) try - Ignition.stop(grid.name, true) + Ignition.stop(ignite.name, true) catch { case e: Exception => warn(e.getMessage) } @@ -2195,7 +2195,7 @@ object visor extends VisorTag { isCon = false conOwner = false conTs = 0 - grid = null + ignite = null nodeJoinLsnr = null nodeLeftLsnr = null nodeSegLsnr = null @@ -2416,7 +2416,7 @@ object visor extends VisorTag { ) override def run() { - val g = grid + val g = ignite if (g != null) { try { @@ -2485,7 +2485,7 @@ object visor extends VisorTag { * Does topology snapshot. */ private def snapshot() { - val g = grid + val g = ignite if (g != null) try @@ -2519,8 +2519,8 @@ object visor extends VisorTag { } logText("H/N/C" + pipe + - IgniteUtils.neighborhood(grid.nodes()).size.toString.padTo(4, ' ') + pipe + - grid.nodes().size().toString.padTo(4, ' ') + pipe + + IgniteUtils.neighborhood(ignite.nodes()).size.toString.padTo(4, ' ') + pipe + + ignite.nodes().size().toString.padTo(4, ' ') + pipe + m.getTotalCpus.toString.padTo(4, ' ') + pipe + bar(m.getAverageCpuLoad, m.getHeapMemoryUsed / m.getHeapMemoryMaximum) + pipe ) @@ -2622,7 +2622,7 @@ object visor extends VisorTag { * @return Collection of nodes that has specified ID8. */ def nodeById8(id8: String) = { - grid.nodes().filter(n => id8.equalsIgnoreCase(nid8(n))) + ignite.nodes().filter(n => id8.equalsIgnoreCase(nid8(n))) } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/db09278d/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala ---------------------------------------------------------------------- diff --git a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala index 0212d65..9fd91d2 100644 --- a/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala +++ b/modules/visor-console/src/test/scala/org/apache/ignite/visor/commands/tasks/VisorTasksCommandSpec.scala @@ -46,7 +46,7 @@ class VisorTasksCommandSpec extends FlatSpec with Matchers with BeforeAndAfterAl visor.open(config("grid-visor"), "n/a") try { - val compute = visor.grid.compute().withAsync + val compute = visor.ignite.compute().withAsync compute.withName("TestTask1").execute(new TestTask1(), null)