ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [20/28] incubator-ignite git commit: # Ignite-639 Fixed Visor console cache command.
Date Thu, 09 Apr 2015 06:04:05 GMT
# Ignite-639 Fixed Visor console cache command.


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

Branch: refs/heads/ignite-694
Commit: 36c330a6ab0f8bff24ef05933dd079f11d76b63a
Parents: c6de5e1
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Tue Apr 7 21:38:09 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Tue Apr 7 21:38:09 2015 +0700

----------------------------------------------------------------------
 .../cache/VisorCacheMetricsCollectorTask.java   | 10 +++++--
 .../commands/cache/VisorCacheCommand.scala      | 29 +++++++++++++-------
 2 files changed, 27 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/36c330a6/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
index b4b850b..ee0b962 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetricsCollectorTask.java
@@ -46,7 +46,7 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
         Map<String, VisorCacheAggregatedMetrics> grpAggrMetrics = U.newHashMap(results.size());
 
         for (ComputeJobResult res : results) {
-            if (res.getException() == null && res.getData() instanceof Map<?,
?>) {
+            if (res.getException() == null) {
                 Collection<VisorCacheMetrics> cms = res.getData();
 
                 for (VisorCacheMetrics cm : cms) {
@@ -109,7 +109,13 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
                 if (ca.context().started()) {
                     VisorCacheMetrics cm = VisorCacheMetrics.from(ignite, ca);
 
-                    if ((showSysCaches && cm.system()) || allCaches || cacheNames.contains(ca.name()))
+                    boolean addCache = allCaches || cacheNames.contains(ca.name());
+
+                    if (showSysCaches) {
+                        if (cm.system() && addCache)
+                            res.add(cm);
+                    }
+                    else if (!cm.system() && addCache)
                         res.add(cm);
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/36c330a6/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 df3007c..b8f2a35 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
@@ -221,9 +221,9 @@ class VisorCacheCommand {
             if (hasArgFlag("i", argLst)) {
                 askForNode("Select node from:") match {
                     case Some(nid) => ask("Detailed statistics (y/n) [n]: ", "n") match
{
-                        case "n" | "N" => nl(); cache("-id=" + nid).^^
-                        case "y" | "Y" => nl(); cache("-a -id=" + nid).^^
-                        case x => nl(); warn("Invalid answer: " + x).^^
+                        case "n" | "N" => nl(); cache("-id=" + nid); return;
+                        case "y" | "Y" => nl(); cache("-a -id=" + nid); return;
+                        case x => nl(); warn("Invalid answer: " + x); return;
                     }
                     case None => return
                 }
@@ -302,11 +302,17 @@ class VisorCacheCommand {
             val sortType = argValue("s", argLst)
             val reversed = hasArgName("r", argLst)
 
-            if (sortType.isDefined && !isValidSortType(sortType.get))
-                scold("Invalid '-s' argument in: " + args).^^
+            if (sortType.isDefined && !isValidSortType(sortType.get)) {
+                scold("Invalid '-s' argument in: " + args)
 
-            if (aggrData.isEmpty)
-                scold("No caches found.").^^
+                return
+            }
+
+            if (aggrData.isEmpty) {
+                scold("No caches found.")
+
+                return
+            }
 
             println("Time of the snapshot: " + formatDateTime(System.currentTimeMillis))
 
@@ -493,7 +499,7 @@ class VisorCacheCommand {
 
             val nids = prj.nodes().map(_.id())
 
-            val caches: JavaCollection[String] = new JavaList[String](1)
+            val caches: JavaCollection[String] = new JavaList[String]()
             name.foreach(caches.add)
 
             ignite.compute(prj).execute(classOf[VisorCacheMetricsCollectorTask], toTaskArgument(nids,
@@ -602,8 +608,11 @@ class VisorCacheCommand {
         assert(title != null)
         assert(visor.visor.isConnected)
 
-        if (aggrData.isEmpty)
-            scold("No caches found.").^^
+        if (aggrData.isEmpty) {
+            scold("No caches found.")
+
+            return None
+        }
 
         val sortedAggrData = sortAggregatedData(aggrData, "cn", false)
 


Mime
View raw message