ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject [06/50] incubator-ignite git commit: # ignite-gg-9830 WIP
Date Wed, 29 Apr 2015 09:46:13 GMT
# ignite-gg-9830 WIP


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

Branch: refs/heads/ignite-831
Commit: b80d41ba6aee7ab63c7e74ca0619cb76c4d09771
Parents: 2116b88
Author: Andrey <anovikov@gridgain.com>
Authored: Mon Apr 27 15:23:16 2015 +0700
Committer: Andrey <anovikov@gridgain.com>
Committed: Mon Apr 27 15:23:16 2015 +0700

----------------------------------------------------------------------
 .../ignite/visor/commands/VisorConsole.scala    |  5 +-
 .../commands/events/VisorEventsCommand.scala    | 54 ++++++++++++--------
 2 files changed, 38 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b80d41ba/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
index daca942..25709d0 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/VisorConsole.scala
@@ -202,7 +202,10 @@ class VisorConsole {
                             case _ => adviseToHelp(line)
                         }
                     } catch {
-                        case ignore: Exception => adviseToHelp(line)
+                        case ignore: Exception =>
+                            ignore.printStackTrace()
+
+                            adviseToHelp(line)
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b80d41ba/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
index 2299c4a..c96c8ac 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/events/VisorEventsCommand.scala
@@ -137,25 +137,35 @@ class VisorEventsCommand extends VisorConsoleCommand {
             }
     }
 
+    /**
+     * Gets type filter by mnemonics.
+     * @param typeArg Type mnemonics.
+     * @throws IllegalArgumentException In case unknown event mnemonic.
+     * @return Type id filter.
+     */
+    @throws[IllegalArgumentException]("In case unknown event mnemonic.")
     protected def typeFilter(typeArg: Option[String]) = {
-        if (typeArg.isEmpty)
-            null
-        else {
-            val arr = collection.mutable.ArrayBuffer.empty[Int]
-
-            typeArg.get split "," foreach {
-                case "ch" => arr ++= EVTS_CHECKPOINT.toList
-                case "de" => arr ++= EVTS_DEPLOYMENT.toList
-                case "jo" => arr ++= EVTS_JOB_EXECUTION.toList
-                case "ta" => arr ++= EVTS_TASK_EXECUTION.toList
-                case "ca" => arr ++= EVTS_CACHE.toList
-                case "cr" => arr ++= EVTS_CACHE_REBALANCE.toList
-                case "sw" => arr ++= EVTS_SWAPSPACE.toList
-                case "di" => arr ++= EVTS_DISCOVERY.toList
-                case t => throw new IllegalArgumentException("Unknown event type: " +
t)
-            }
+        typeArg.map(_.split(",").map(typeIds).flatten).orNull
+    }
 
-            arr.toArray
+    /**
+     * Gets type filter by mnemonic.
+     * @param mnemonic Type mnemonic.
+     * @throws IllegalArgumentException In case unknown event mnemonic.
+     * @return Type id filter.
+     */
+    @throws[IllegalArgumentException]("In case unknown event mnemonic.")
+    protected def typeIds(mnemonic: String) = {
+        mnemonic match {
+            case "ch" => EVTS_CHECKPOINT
+            case "de" => EVTS_DEPLOYMENT
+            case "di" => EVTS_DISCOVERY
+            case "jo" => EVTS_JOB_EXECUTION
+            case "ta" => EVTS_TASK_EXECUTION
+            case "ca" => EVTS_CACHE
+            case "cr" => EVTS_CACHE_REBALANCE
+            case "sw" => EVTS_SWAPSPACE
+            case t => throw new IllegalArgumentException("Unknown event mnemonic: " +
t)
         }
     }
 
@@ -163,19 +173,23 @@ class VisorEventsCommand extends VisorConsoleCommand {
      * Gets command's mnemonic for given event.
      *
      * @param e Event to get mnemonic for.
+     * @throws IllegalArgumentException In case unknown event type.
+     * @return Type mnemonic.
      */
-    private def mnemonic(e: VisorGridEvent): String = {
+    @throws[IllegalArgumentException]("In case unknown event type.")
+    protected def mnemonic(e: VisorGridEvent) = {
         assert(e != null)
 
         e.typeId() match {
-            case t if EVTS_DISCOVERY_ALL.contains(t) => "di"
             case t if EVTS_CHECKPOINT.contains(t) => "ch"
             case t if EVTS_DEPLOYMENT.contains(t) => "de"
+            case t if EVTS_DISCOVERY_ALL.contains(t) => "di"
             case t if EVTS_JOB_EXECUTION.contains(t)=> "jo"
             case t if EVTS_TASK_EXECUTION.contains(t) => "ta"
             case t if EVTS_CACHE.contains(t) => "ca"
-            case t if EVTS_SWAPSPACE.contains(t) => "sw"
             case t if EVTS_CACHE_REBALANCE.contains(t) => "cr"
+            case t if EVTS_SWAPSPACE.contains(t) => "sw"
+            case t => throw new IllegalArgumentException("Unknown event type: " + t)
         }
     }
 


Mime
View raw message