ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [12/37] incubator-ignite git commit: # IGNITE-593 WIP.
Date Tue, 07 Apr 2015 11:55:09 GMT
# IGNITE-593 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/b6c605c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/b6c605c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/b6c605c1

Branch: refs/heads/ignite-688
Commit: b6c605c118b511f4191fd70825013c842a1d3a8c
Parents: 903bbdd
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Mon Apr 6 17:39:16 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Mon Apr 6 17:39:16 2015 +0700

----------------------------------------------------------------------
 .../VisorCacheConfigurationCollectorJob.java    |  8 +++--
 .../VisorCacheConfigurationCollectorTask.java   | 26 ++------------
 .../visor/node/VisorGridConfiguration.java      | 38 --------------------
 .../commands/cache/VisorCacheCommand.scala      | 25 +++++++------
 4 files changed, 22 insertions(+), 75 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6c605c1/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
index aee75f6..ef12424 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
@@ -28,8 +28,8 @@ import java.util.*;
 /**
  * Job that collect cache metrics from node.
  */
-public class VisorCacheConfigurationCollectorJob extends VisorJob<Collection<IgniteUuid>,
-    Map<IgniteUuid, VisorCacheConfiguration>> {
+public class VisorCacheConfigurationCollectorJob
+    extends VisorJob<Collection<IgniteUuid>, Map<IgniteUuid, VisorCacheConfiguration>>
{
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -47,12 +47,14 @@ public class VisorCacheConfigurationCollectorJob extends VisorJob<Collection<Ign
     @Override protected Map<IgniteUuid, VisorCacheConfiguration> run(Collection<IgniteUuid>
arg) {
         Collection<GridCacheAdapter<?, ?>> caches = ignite.context().cache().internalCaches();
 
+        boolean all = arg == null || arg.isEmpty();
+
         Map<IgniteUuid, VisorCacheConfiguration> res = U.newHashMap(caches.size());
 
         for (GridCacheAdapter<?, ?> cache : caches) {
             IgniteUuid deploymentId = cache.context().dynamicDeploymentId();
 
-            if (arg.contains(deploymentId))
+            if (all || arg.contains(deploymentId))
                 res.put(deploymentId, config(cache.configuration()));
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6c605c1/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 9552c86..53d1105 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
@@ -17,13 +17,9 @@
 
 package org.apache.ignite.internal.visor.cache;
 
-import org.apache.ignite.*;
-import org.apache.ignite.compute.*;
 import org.apache.ignite.internal.processors.task.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.internal.visor.*;
 import org.apache.ignite.lang.*;
-import org.jetbrains.annotations.*;
 
 import java.util.*;
 
@@ -31,8 +27,8 @@ import java.util.*;
  * Task that collect cache metrics from all nodes.
  */
 @GridInternal
-public class VisorCacheConfigurationCollectorTask extends VisorMultiNodeTask<Collection<IgniteUuid>,
-    Map<UUID, Map<IgniteUuid, VisorCacheConfiguration>>, Map<IgniteUuid, VisorCacheConfiguration>>
{
+public class VisorCacheConfigurationCollectorTask
+    extends VisorOneNodeTask<Collection<IgniteUuid>, Collection<VisorCacheConfiguration>>
{
     /** */
     private static final long serialVersionUID = 0L;
 
@@ -40,22 +36,4 @@ public class VisorCacheConfigurationCollectorTask extends VisorMultiNodeTask<Col
     @Override protected VisorCacheConfigurationCollectorJob job(Collection<IgniteUuid>
arg) {
         return new VisorCacheConfigurationCollectorJob(arg, debug);
     }
-
-    /** {@inheritDoc} */
-    @Nullable @Override protected Map<UUID, Map<IgniteUuid, VisorCacheConfiguration>>
reduce0(
-        List<ComputeJobResult> results)
-        throws IgniteException {
-        Map<UUID, Map<IgniteUuid, VisorCacheConfiguration>> taskRes = U.newHashMap(results.size());
-
-        for (ComputeJobResult jobRes : results) {
-            if (jobRes.getException() != null)
-                throw jobRes.getException();
-
-            Map<IgniteUuid, VisorCacheConfiguration> ccfgs = jobRes.getData();
-
-            taskRes.put(jobRes.getNode().id(), ccfgs);
-        }
-
-        return taskRes;
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6c605c1/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
index 6548d07..002596b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorGridConfiguration.java
@@ -21,7 +21,6 @@ import org.apache.ignite.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.internal.visor.cache.*;
 
 import java.io.*;
 import java.util.*;
@@ -68,9 +67,6 @@ public class VisorGridConfiguration implements Serializable {
     /** User attributes. */
     private Map<String, ?> userAttrs;
 
-    /** Caches. */
-    private Iterable<VisorCacheConfiguration> caches;
-
     /** Igfss. */
     private Iterable<VisorIgfsConfiguration> igfss;
 
@@ -106,7 +102,6 @@ public class VisorGridConfiguration implements Serializable {
         inclEvtTypes = c.getIncludeEventTypes();
         rest = VisorRestConfiguration.from(c);
         userAttrs = c.getUserAttributes();
-        caches = collectCaches(ignite, c.getCacheConfiguration());
         igfss = VisorIgfsConfiguration.list(c.getFileSystemConfiguration());
         env = new HashMap<>(System.getenv());
         sysProps = IgniteSystemProperties.snapshot();
@@ -194,39 +189,6 @@ public class VisorGridConfiguration implements Serializable {
     }
 
     /**
-     * @return List of data transfer objects for caches.
-     */
-    private Iterable<VisorCacheConfiguration> collectCaches(IgniteEx ignite, CacheConfiguration[]
ccfgs) {
-        if (ccfgs == null)
-            return Collections.emptyList();
-
-        final Collection<VisorCacheConfiguration> res = new ArrayList<>(ccfgs.length);
-
-        for (CacheConfiguration ccfg : ccfgs)
-            res.add(collectCache(ignite, ccfg));
-
-        return res;
-    }
-
-    /**
-     * Create data transfer object for cache configuration.
-     *
-     * @param ignite Ignite instance.
-     * @param ccfg Cache configuration.
-     * @return Data transfer objects for cache
-     */
-    protected VisorCacheConfiguration collectCache(IgniteEx ignite, CacheConfiguration ccfg)
{
-        return new VisorCacheConfiguration().from(ignite, ccfg);
-    }
-
-    /**
-     * @return Caches.
-     */
-    public Iterable<VisorCacheConfiguration> caches() {
-        return caches;
-    }
-
-    /**
      * @return Igfss.
      */
     public Iterable<VisorIgfsConfiguration> igfss() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6c605c1/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 539d3d2..2d7e14b 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,14 +20,15 @@ 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.node.{VisorGridConfiguration, VisorNodeConfigurationCollectorTask}
 import org.apache.ignite.internal.visor.util.VisorTaskUtils._
-import org.apache.ignite.lang.IgniteBiTuple
+import org.apache.ignite.lang.{IgniteUuid, IgniteBiTuple}
 import org.jetbrains.annotations._
 
 import java.lang.{Boolean => JavaBoolean}
-import java.util.UUID
+import java.util.{Collections, UUID}
 
 import org.apache.ignite.visor.VisorTag
 import org.apache.ignite.visor.commands.cache.VisorCacheCommand._
@@ -385,13 +386,13 @@ class VisorCacheCommand {
                         println("  Total number of executions: " + ad.execsQuery)
                         println("  Total number of failures:   " + ad.failsQuery)
 
-                        gCfg.foreach(_.caches().find(_.name() == ad.cacheName()).foreach(cfg
=> {
-                            nl()
+                        gCfg.foreach(ccfgs => ccfgs.find(ccfg => safeEquals(ccfg.name(),
ad.cacheName()))
+                            .foreach(cfg => {
+                                nl()
 
-                            showCacheConfiguration("Cache configuration:", cfg)
+                                showCacheConfiguration("Cache configuration:", cfg)
                         }))
                     })
-
                 }
                 else
                     println("\nUse \"-a\" flag to see detailed statistics.")
@@ -464,10 +465,14 @@ class VisorCacheCommand {
      * @param node Specified node.
      * @return Grid configuration for specified node.
      */
-    private def config(node: ClusterNode): VisorGridConfiguration = {
-        try
+    private def config(node: ClusterNode) = {
+        try {
+            val z = Collections.emptySet()[IgniteUuid]
+
             ignite.compute(ignite.cluster.forNode(node)).withNoFailover()
-                .execute(classOf[VisorNodeConfigurationCollectorTask], emptyTaskArgument(node.id()))
+                .execute(classOf[VisorCacheConfigurationCollectorTask],
+                    toTaskArgument(node.id(), z.asInstanceOf[util.Collection[IgniteUuid]]))
+        }
         catch {
             case e: IgniteException =>
                 scold(e.getMessage)


Mime
View raw message