ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject [11/22] incubator-ignite git commit: # Ignite-639 Review.
Date Wed, 08 Apr 2015 11:10:18 GMT
# Ignite-639 Review.


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

Branch: refs/heads/ignite-sprint-3
Commit: 5dd8ff1fffe4b858a1d6f11661b38a2af1065444
Parents: 03a2b3f
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Fri Apr 3 23:09:35 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Fri Apr 3 23:09:35 2015 +0700

----------------------------------------------------------------------
 .../org/apache/ignite/internal/IgniteEx.java    | 10 +---
 .../apache/ignite/internal/IgniteKernal.java    | 12 ++---
 .../visor/cache/VisorCacheConfiguration.java    |  4 +-
 .../cache/VisorCacheMetricsCollectorTask.java   | 57 ++++++++------------
 .../HadoopDefaultMapReducePlannerSelfTest.java  |  5 --
 5 files changed, 28 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5dd8ff1f/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
index 6604050..ea6e773 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
@@ -69,14 +69,6 @@ public interface IgniteEx extends Ignite {
     public Collection<GridCache<?, ?>> cachesx(@Nullable IgnitePredicate<?
super GridCache<?, ?>>... p);
 
     /**
-     * Gets system state of cache with specified name.
-     *
-     * @param name Cache name.
-     * @return {@code true} if cache with specified name is system.
-     */
-    public boolean systemCache(@Nullable String name);
-
-    /**
      * Checks if the event type is user-recordable.
      *
      * @param type Event type to check.
@@ -132,7 +124,7 @@ public interface IgniteEx extends Ignite {
     public Hadoop hadoop();
 
     /** {@inheritDoc} */
-    @Override IgniteClusterEx cluster();
+    @Override public IgniteClusterEx cluster();
 
     /**
      * Get latest version in string form.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5dd8ff1f/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 225d15f..2e53270 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -451,8 +451,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
         assert cfg != null;
 
         return F.transform(cfg.getUserAttributes().entrySet(), new C1<Map.Entry<String,
?>, String>() {
-            @Override
-            public String apply(Map.Entry<String, ?> e) {
+            @Override public String apply(Map.Entry<String, ?> e) {
                 return e.getKey() + ", " + e.getValue().toString();
             }
         });
@@ -1877,7 +1876,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
             try {
                 U.onGridStop();
             }
-            catch (InterruptedException e) {
+            catch (InterruptedException ignored) {
                 // Preserve interrupt status.
                 Thread.currentThread().interrupt();
             }
@@ -1924,7 +1923,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
      *
      * @return Kernal context.
      */
-    public GridKernalContext context() {
+    @Override public GridKernalContext context() {
         return ctx;
     }
 
@@ -2445,11 +2444,6 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
     }
 
     /** {@inheritDoc} */
-    @Override public boolean systemCache(@Nullable String name) {
-        return ctx.cache().systemCache(name);
-    }
-
-    /** {@inheritDoc} */
     @Override public <K, V> GridCache<K, V> cachex() {
         guard();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5dd8ff1f/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
index d3696fe..86a7f5f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheConfiguration.java
@@ -116,7 +116,7 @@ public class VisorCacheConfiguration implements Serializable {
     /** Query configuration. */
     private VisorCacheQueryConfiguration qryCfg;
 
-    /** System cache state. */
+    /** System cache flag. */
     private boolean sys;
 
     /**
@@ -145,7 +145,7 @@ public class VisorCacheConfiguration implements Serializable {
         ldrFactory = compactClass(ccfg.getCacheLoaderFactory());
         writerFactory = compactClass(ccfg.getCacheWriterFactory());
         expiryPlcFactory = compactClass(ccfg.getExpiryPolicyFactory());
-        sys = ignite.systemCache(ccfg.getName());
+        sys = ignite.context().cache().systemCache(ccfg.getName());
         
         affinityCfg = VisorCacheAffinityConfiguration.from(ccfg);
         rebalanceCfg = VisorCacheRebalanceConfiguration.from(ccfg);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5dd8ff1f/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 e4495aa..615935a 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
@@ -87,52 +87,39 @@ public class VisorCacheMetricsCollectorTask extends VisorMultiNodeTask<IgniteBiT
 
         /** {@inheritDoc} */
         @Override protected Map<String, VisorCacheMetrics> run(final IgniteBiTuple<Boolean,
Collection<String>> arg) {
-            Collection<? extends GridCache<?, ?>> caches =
-                ignite.cachesx(new VisorCachesFilterPredicate(arg.get1(), arg.get2()));
+            assert arg != null;
 
-            if (caches != null) {
-                Map<String, VisorCacheMetrics> res = U.newHashMap(caches.size());
+            Boolean showSysCaches = arg.get1();
 
-                for (GridCache<?, ?> c : caches)
-                    res.put(c.name(), VisorCacheMetrics.from(c));
+            assert showSysCaches != null;
 
-                return res;
-            }
+            Collection<String> cacheNames = arg.get2();
 
-            return null;
-        }
+            assert cacheNames != null;
 
-        /** {@inheritDoc} */
-        @Override public String toString() {
-            return S.toString(VisorCacheMetricsCollectorJob.class, this);
-        }
-    }
+            GridCacheProcessor cacheProcessor = ignite.context().cache();
 
-    /**
-     * Predicate to filter required caches.
-     */
-    private static class VisorCachesFilterPredicate implements IgnitePredicate<GridCache<?,?>>
{
-        /** Select system caches. */
-        private final Boolean showSystem;
+            Collection<GridCacheAdapter<?, ?>> caches = cacheProcessor.internalCaches();
 
-        /** Name of caches for selection */
-        private final Collection<String> names;
+            Map<String, VisorCacheMetrics> res = U.newHashMap(caches.size());
 
-        /**
-         * Create cache filtration predicate.
-         *
-         * @param showSystem Select system caches.
-         * @param names Name of caches for selection.
-         */
-        VisorCachesFilterPredicate(Boolean showSystem, Collection<String> names) {
-            this.showSystem = showSystem;
-            this.names = names;
+            boolean allCaches = cacheNames.isEmpty();
+
+            for (GridCacheAdapter ca : caches) {
+                if (ca.context().started()) {
+                    String name = ca.name();
+
+                    if ((showSysCaches && cacheProcessor.systemCache(name)) || allCaches
|| cacheNames.contains(name))
+                        res.put(name, VisorCacheMetrics.from(ca));
+                }
+            }
+
+            return res;
         }
 
         /** {@inheritDoc} */
-        @Override public boolean apply(GridCache<?, ?> cache) {
-            return (showSystem || !CU.isSystemCache(cache.name()))
-                && (names == null || names.isEmpty() || names.contains(cache.name()));
+        @Override public String toString() {
+            return S.toString(VisorCacheMetricsCollectorJob.class, this);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/5dd8ff1f/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
index bd84be2..7075f2e 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopDefaultMapReducePlannerSelfTest.java
@@ -961,11 +961,6 @@ public class HadoopDefaultMapReducePlannerSelfTest extends HadoopAbstractSelfTes
         }
 
         /** {@inheritDoc} */
-        @Override public boolean systemCache(@Nullable String name) {
-            return false;
-        }
-
-        /** {@inheritDoc} */
         @SuppressWarnings("unchecked")
         @Override public Collection<GridCache<?, ?>> cachesx(@Nullable IgnitePredicate<?
super GridCache<?, ?>>... p) {
             return null;


Mime
View raw message