ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [07/16] incubator-ignite git commit: # IGNITE-593 WIP.
Date Tue, 07 Apr 2015 04:29:51 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/520cc47b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/520cc47b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/520cc47b

Branch: refs/heads/ignite-639
Commit: 520cc47be0d53dc9b72409a56618231ce985cda7
Parents: 0a81542
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Fri Apr 3 18:21:35 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Fri Apr 3 18:21:35 2015 +0700

----------------------------------------------------------------------
 .../ignite/internal/visor/cache/VisorCache.java |  7 +-
 .../VisorCacheConfigurationCollectorJob.java    | 74 ++++++++++++++++++++
 .../VisorCacheConfigurationCollectorTask.java   | 61 ++++++++++++++++
 .../VisorIgfsProfilerUniformityCounters.java    |  6 +-
 .../visor/node/VisorIgfsConfiguration.java      |  2 +-
 .../visor/node/VisorRestConfiguration.java      |  1 +
 .../internal/visor/util/VisorTaskUtils.java     |  3 +-
 7 files changed, 145 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/520cc47b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
index 56aefff..6245017 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
@@ -101,12 +101,12 @@ public class VisorCache implements Serializable {
      * @param cacheName Cache name.
      * @param sample Sample size.
      * @return Data transfer object for given cache.
-     * @throws IgniteCheckedException
+     * @throws IgniteCheckedException If failed to create data transfer object.
      */
-    public static VisorCache from(Ignite ignite, String cacheName, int sample) throws IgniteCheckedException
{
+    public static VisorCache from(IgniteEx ignite, String cacheName, int sample) throws IgniteCheckedException
{
         assert ignite != null;
 
-        GridCacheAdapter ca = ((IgniteKernal)ignite).internalCache(cacheName);
+        GridCacheAdapter ca = ignite.context().cache().internalCache(cacheName);
 
         // Cache was not started.
         if (ca == null || !ca.context().started())
@@ -132,7 +132,6 @@ public class VisorCache implements Serializable {
 
         CacheMode mode = cfg.getCacheMode();
 
-
         boolean partitioned = (mode == CacheMode.PARTITIONED || mode == CacheMode.REPLICATED)
             && ca.context().affinityNode();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/520cc47b/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
new file mode 100644
index 0000000..aee75f6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorJob.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.visor.cache;
+
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.internal.visor.*;
+import org.apache.ignite.lang.*;
+
+import java.util.*;
+
+/**
+ * Job that collect cache metrics from node.
+ */
+public class VisorCacheConfigurationCollectorJob extends VisorJob<Collection<IgniteUuid>,
+    Map<IgniteUuid, VisorCacheConfiguration>> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /**
+     * Create job with given argument.
+     *
+     * @param arg Whether to collect metrics for all caches or for specified cache name only.
+     * @param debug Debug flag.
+     */
+    public VisorCacheConfigurationCollectorJob(Collection<IgniteUuid> arg, boolean
debug) {
+        super(arg, debug);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected Map<IgniteUuid, VisorCacheConfiguration> run(Collection<IgniteUuid>
arg) {
+        Collection<GridCacheAdapter<?, ?>> caches = ignite.context().cache().internalCaches();
+
+        Map<IgniteUuid, VisorCacheConfiguration> res = U.newHashMap(caches.size());
+
+        for (GridCacheAdapter<?, ?> cache : caches) {
+            IgniteUuid deploymentId = cache.context().dynamicDeploymentId();
+
+            if (arg.contains(deploymentId))
+                res.put(deploymentId, config(cache.configuration()));
+        }
+
+        return res;
+    }
+
+    /**
+     * @param ccfg Cache configuration.
+     * @return Data transfer object to send it to Visor.
+     */
+    protected VisorCacheConfiguration config(CacheConfiguration ccfg) {
+        return new VisorCacheConfiguration().from(ignite, ccfg);
+    }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(VisorCacheConfigurationCollectorJob.class, this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/520cc47b/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
new file mode 100644
index 0000000..9552c86
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfigurationCollectorTask.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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.*;
+
+/**
+ * Task that collect cache metrics from all nodes.
+ */
+@GridInternal
+public class VisorCacheConfigurationCollectorTask extends VisorMultiNodeTask<Collection<IgniteUuid>,
+    Map<UUID, Map<IgniteUuid, VisorCacheConfiguration>>, Map<IgniteUuid, VisorCacheConfiguration>>
{
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @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/520cc47b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
index 7bbafd5..1ce1c64 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/igfs/VisorIgfsProfilerUniformityCounters.java
@@ -26,9 +26,9 @@ import static org.apache.ignite.internal.visor.igfs.VisorIgfsProfiler.*;
 
 /**
  * Class to support uniformity calculation.
- *<p>
- *<a href="http://en.wikipedia.org/wiki/Coefficient_of_variation">Uniformity calculated
as coefficient of variation.</a>
- *</p>
+ * <p>
+ * <a href="http://en.wikipedia.org/wiki/Coefficient_of_variation">Uniformity calculated
as coefficient of variation.</a>
+ * </p>
  * Count read frequency for each file and compare with ideal uniform distribution.
  */
 public class VisorIgfsProfilerUniformityCounters implements Serializable {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/520cc47b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
index d0b0124..3bd27b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java
@@ -158,7 +158,7 @@ public class VisorIgfsConfiguration implements Serializable {
         cfg.fragmentizerThrottlingBlockLen = igfs.getFragmentizerThrottlingBlockLength();
         cfg.fragmentizerThrottlingDelay = igfs.getFragmentizerThrottlingDelay();
 
-        IgfsIpcEndpointConfiguration  endpointCfg = igfs.getIpcEndpointConfiguration();
+        IgfsIpcEndpointConfiguration endpointCfg = igfs.getIpcEndpointConfiguration();
 
         cfg.ipcEndpointCfg = endpointCfg != null ? endpointCfg.toString() : null;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/520cc47b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
index f279253..e2ac497 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorRestConfiguration.java
@@ -93,6 +93,7 @@ public class VisorRestConfiguration implements Serializable {
     public boolean restEnabled() {
         return restEnabled;
     }
+
     /**
      * @return Whether or not SSL is enabled for TCP binary protocol.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/520cc47b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index 1209a40..b7f852a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -836,7 +836,8 @@ public class VisorTaskUtils {
                 zos.putNextEntry(entry);
 
                 zos.write(input);
-            } finally {
+            }
+            finally {
                 zos.closeEntry();
             }
         }


Mime
View raw message