ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [20/50] [abbrv] incubator-ignite git commit: # Ignite-593 Reworked cache configurations collect and process.
Date Tue, 07 Apr 2015 09:35:18 GMT
# Ignite-593 Reworked cache configurations collect and process.


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

Branch: refs/heads/ignite-684
Commit: fe57a53c3b4fca401969dba6acd85f5726ea1101
Parents: c0d6e89
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Mon Apr 6 22:43:43 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Mon Apr 6 22:43:43 2015 +0700

----------------------------------------------------------------------
 .../VisorCacheConfigurationCollectorTask.java   |  2 +-
 .../commands/cache/VisorCacheCommand.scala      | 19 ++++-------
 .../config/VisorConfigurationCommand.scala      | 15 +++++----
 .../visor/commands/gc/VisorGcCommand.scala      | 15 +++++----
 .../scala/org/apache/ignite/visor/visor.scala   | 34 ++++++++++++++++----
 5 files changed, 52 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe57a53c/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
index 53d1105..a92dd3c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
@@ -28,7 +28,7 @@ import java.util.*;
  */
 @GridInternal
 public class VisorCacheConfigurationCollectorTask
-    extends VisorOneNodeTask<Collection<IgniteUuid>, Collection<VisorCacheConfiguration>>
{
+    extends VisorOneNodeTask<Collection<IgniteUuid>, Map<IgniteUuid, VisorCacheConfiguration>>
{
     /** */
     private static final long serialVersionUID = 0L;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe57a53c/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 2d7e14b..91317c9 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -20,7 +20,6 @@ package org.apache.ignite.visor.commands.cache
 import org.apache.ignite._
 import org.apache.ignite.cluster.ClusterNode
 import org.apache.ignite.internal.util.typedef._
-import java.util
 
 import org.apache.ignite.internal.visor.cache._
 import org.apache.ignite.internal.visor.util.VisorTaskUtils._
@@ -28,7 +27,7 @@ import org.apache.ignite.lang.{IgniteUuid, IgniteBiTuple}
 import org.jetbrains.annotations._
 
 import java.lang.{Boolean => JavaBoolean}
-import java.util.{Collections, UUID}
+import java.util.{Collection => JavaCollection, Collections, UUID}
 
 import org.apache.ignite.visor.VisorTag
 import org.apache.ignite.visor.commands.cache.VisorCacheCommand._
@@ -387,10 +386,10 @@ class VisorCacheCommand {
                         println("  Total number of failures:   " + ad.failsQuery)
 
                         gCfg.foreach(ccfgs => ccfgs.find(ccfg => safeEquals(ccfg.name(),
ad.cacheName()))
-                            .foreach(cfg => {
+                            .foreach(ccfg => {
                                 nl()
 
-                                showCacheConfiguration("Cache configuration:", cfg)
+                                showCacheConfiguration("Cache configuration:", ccfg)
                         }))
                     })
                 }
@@ -463,21 +462,17 @@ class VisorCacheCommand {
      * Gets configuration of grid from specified node for callecting of node cache's configuration.
      *
      * @param node Specified node.
-     * @return Grid configuration for specified node.
+     * @return Cache configurations for specified node.
      */
-    private def config(node: ClusterNode) = {
+    private def config(node: ClusterNode): JavaCollection[VisorCacheConfiguration] = {
         try {
-            val z = Collections.emptySet()[IgniteUuid]
-
-            ignite.compute(ignite.cluster.forNode(node)).withNoFailover()
-                .execute(classOf[VisorCacheConfigurationCollectorTask],
-                    toTaskArgument(node.id(), z.asInstanceOf[util.Collection[IgniteUuid]]))
+            cacheConfigurations(node.id())
         }
         catch {
             case e: IgniteException =>
                 scold(e.getMessage)
 
-                null
+                Collections.emptyList()
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe57a53c/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
index c4ac1c0..447667a 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/config/VisorConfigurationCommand.scala
@@ -20,7 +20,6 @@ package org.apache.ignite.visor.commands.config
 import org.apache.ignite._
 import org.apache.ignite.cluster.ClusterNode
 import org.apache.ignite.internal.util.{IgniteUtils => U}
-import org.apache.ignite.internal.visor.node.VisorNodeConfigurationCollectorTask
 import org.apache.ignite.internal.visor.util.VisorTaskUtils._
 import org.apache.ignite.lang.IgniteBiTuple
 
@@ -184,9 +183,7 @@ class VisorConfigurationCommand {
             assert(node != null)
 
             val cfg = try
-                ignite.compute(ignite.cluster.forNode(node))
-                    .withNoFailover()
-                    .execute(classOf[VisorNodeConfigurationCollectorTask], emptyTaskArgument(node.id()))
+                nodeConfiguration(node.id())
             catch {
                 case e: IgniteException =>
                     scold(e.getMessage)
@@ -392,9 +389,13 @@ class VisorConfigurationCommand {
             } else
                 println("\nNo system properties defined.")
 
-            cfg.caches().foreach(cacheCfg => {
-                VisorCacheCommand.showCacheConfiguration("\nCache '" + escapeName(cacheCfg.name())
+ "':", cacheCfg)
-            })
+            try
+                cacheConfigurations(node.id).foreach(cacheCfg =>
+                    VisorCacheCommand.showCacheConfiguration("\nCache '" + escapeName(cacheCfg.name())
+ "':", cacheCfg))
+            catch {
+                case e: IgniteException =>
+                    scold(e.getMessage)
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe57a53c/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 446f07c..5ec85a7 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
@@ -148,16 +148,17 @@ class VisorGcCommand {
                 val NULL: Void = null
 
                 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)
+                    toTaskArgument(nids, NULL)).foreach {
+                        case (nid, stat) =>
+                            val roundHb = stat.get1() / (1024L * 1024L)
+                            val roundHa = stat.get2() / (1024L * 1024L)
 
-                    val sign = if (roundHa > roundHb) "+" else ""
+                            val sign = if (roundHa > roundHb) "+" else ""
 
-                    val deltaPercent = math.round(roundHa * 100d / roundHb - 100)
+                            val deltaPercent = math.round(roundHa * 100d / roundHb - 100)
 
-                    t += (nodeId8(nid), roundHb + "mb", roundHa + "mb", sign + deltaPercent
+ "%")
-                }
+                            t += (nodeId8(nid), roundHb + "mb", roundHa + "mb", sign + deltaPercent
+ "%")
+                    }
 
                 println("Garbage collector procedure results:")
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe57a53c/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 7b6d1b4..5710458 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
@@ -32,10 +32,11 @@ import org.apache.ignite.internal.util.lang.{GridFunc => F}
 import org.apache.ignite.internal.util.typedef._
 import org.apache.ignite.internal.util.{GridConfigurationFinder, IgniteUtils => U}
 import org.apache.ignite.internal.visor.VisorTaskArgument
-import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask
+import org.apache.ignite.internal.visor.cache._
+import org.apache.ignite.internal.visor.node._
 import org.apache.ignite.internal.visor.node.VisorNodeEventsCollectorTask.VisorNodeEventsCollectorTaskArg
 import org.apache.ignite.internal.visor.util.VisorTaskUtils._
-import org.apache.ignite.lang.{IgniteNotPeerDeployable, IgnitePredicate}
+import org.apache.ignite.lang._
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi
 import org.apache.ignite.thread.IgniteThreadPoolExecutor
 import org.apache.ignite.visor.commands.VisorConsole.consoleReader
@@ -46,7 +47,7 @@ import java.io._
 import java.net._
 import java.text._
 import java.util.concurrent._
-import java.util.{HashSet => JHashSet, _}
+import java.util.{Collection => JavaCollection, HashSet => JavaHashSet, _}
 
 import scala.collection.JavaConversions._
 import scala.collection.immutable
@@ -836,7 +837,7 @@ object visor extends VisorTag {
      * Extract node from command arguments.
      *
      * @param argLst Command arguments.
-     * @return error message or node ref.
+     * @return Error message or node ref.
      */
     def parseNode(argLst: ArgList) = {
         val id8 = argValue("id8", argLst)
@@ -1827,7 +1828,7 @@ object visor extends VisorTag {
     /** Convert to task argument. */
     def emptyTaskArgument[A](nid: UUID): VisorTaskArgument[Void] = new VisorTaskArgument(nid,
false)
 
-    def emptyTaskArgument[A](nids: Iterable[UUID]): VisorTaskArgument[Void] = new VisorTaskArgument(new
JHashSet(nids),
+    def emptyTaskArgument[A](nids: Iterable[UUID]): VisorTaskArgument[Void] = new VisorTaskArgument(new
JavaHashSet(nids),
       false)
 
     /** Convert to task argument. */
@@ -1835,7 +1836,28 @@ object visor extends VisorTag {
 
     /** Convert to task argument. */
     def toTaskArgument[A](nids: Iterable[UUID], arg: A): VisorTaskArgument[A] = new VisorTaskArgument(
-        new JHashSet(nids), arg, false)
+        new JavaHashSet(nids), arg, false)
+
+    def compute(nid: UUID): IgniteCompute = ignite.compute(ignite.cluster.forNodeId(nid)).withNoFailover()
+
+    /**
+     * Gets configuration from specified node.
+     *
+     * @param nid Node ID to collect configuration from.
+     * @return Grid configuration.
+     */
+    def nodeConfiguration(nid: UUID): VisorGridConfiguration =
+        compute(nid).execute(classOf[VisorNodeConfigurationCollectorTask], emptyTaskArgument(nid))
+
+    /**
+     * Gets caches configurations from specified node.
+     *
+     * @param nid Node ID to collect configuration from.
+     * @return Collection of cache configurations.
+     */
+    def cacheConfigurations(nid: UUID): JavaCollection[VisorCacheConfiguration] =
+        compute(nid).execute(classOf[VisorCacheConfigurationCollectorTask],
+            toTaskArgument(nid, null.asInstanceOf[JavaCollection[IgniteUuid]])).values()
 
     /**
      * Asks user to select a node from the list.


Mime
View raw message