ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject [1/2] incubator-ignite git commit: # IGNITE-158 Remove vararg parameters.
Date Wed, 04 Feb 2015 09:49:03 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/sprint-1 70160ee64 -> 603374c78


# IGNITE-158 Remove vararg parameters.


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

Branch: refs/heads/sprint-1
Commit: ac80b2337399176b4a2a46e52b24a2c887e698fd
Parents: 9f04e64
Author: sevdokimov <sergey.evdokimov@jetbrains.com>
Authored: Tue Feb 3 21:33:14 2015 +0300
Committer: sevdokimov <sergey.evdokimov@jetbrains.com>
Committed: Tue Feb 3 21:33:14 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/cluster/ClusterGroup.java |  9 ++--
 .../ignite/internal/ClusterGroupAdapter.java    | 51 +++++---------------
 .../ignite/internal/IgniteClusterAsyncImpl.java | 12 ++---
 .../GridProjectionForCachesSelfTest.java        | 27 +----------
 ...idHadoopDefaultMapReducePlannerSelfTest.java |  6 +--
 5 files changed, 26 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac80b233/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java
index fac0413..04b5036 100644
--- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java
+++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterGroup.java
@@ -143,32 +143,29 @@ public interface ClusterGroup {
      * Creates projection for all nodes that have cache with specified name running.
      *
      * @param cacheName Cache name.
-     * @param cacheNames Optional additional cache names to include into projection.
      * @return Projection over nodes that have specified cache running.
      */
-    public ClusterGroup forCacheNodes(String cacheName, @Nullable String... cacheNames);
+    public ClusterGroup forCacheNodes(String cacheName);
 
     /**
      * Creates projection for all nodes that have cache with specified name running and cache
distribution mode is
      * {@link CacheDistributionMode#PARTITIONED_ONLY} or {@link CacheDistributionMode#NEAR_PARTITIONED}.
      *
      * @param cacheName Cache name.
-     * @param cacheNames Optional additional cache names to include into projection.
      * @return Projection over nodes that have specified cache running.
      * @see CacheConfiguration#getDistributionMode()
      */
-    public ClusterGroup forDataNodes(String cacheName, @Nullable String... cacheNames);
+    public ClusterGroup forDataNodes(String cacheName);
 
     /**
      * Creates projection for all nodes that have cache with specified name running and cache
distribution mode is
      * {@link CacheDistributionMode#CLIENT_ONLY} or {@link CacheDistributionMode#NEAR_ONLY}.
      *
      * @param cacheName Cache name.
-     * @param cacheNames Optional additional cache names to include into projection.
      * @return Projection over nodes that have specified cache running.
      * @see CacheConfiguration#getDistributionMode()
      */
-    public ClusterGroup forClientNodes(String cacheName, @Nullable String... cacheNames);
+    public ClusterGroup forClientNodes(String cacheName);
 
     /**
      * Creates projection for all nodes that have streamer with specified name running.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac80b233/modules/core/src/main/java/org/apache/ignite/internal/ClusterGroupAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/ClusterGroupAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/ClusterGroupAdapter.java
index 8b8de37..2935f7f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/ClusterGroupAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/ClusterGroupAdapter.java
@@ -536,18 +536,18 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable
{
     }
 
     /** {@inheritDoc} */
-    @Override public final ClusterGroup forCacheNodes(@Nullable String cacheName, @Nullable
String... cacheNames) {
-        return forPredicate(new CachesFilter(cacheName, cacheNames, null));
+    @Override public final ClusterGroup forCacheNodes(@Nullable String cacheName) {
+        return forPredicate(new CachesFilter(cacheName, null));
     }
 
     /** {@inheritDoc} */
-    @Override public final ClusterGroup forDataNodes(@Nullable String cacheName, @Nullable
String... cacheNames) {
-        return forPredicate(new CachesFilter(cacheName, cacheNames, CachesFilter.DATA_MODES));
+    @Override public final ClusterGroup forDataNodes(@Nullable String cacheName) {
+        return forPredicate(new CachesFilter(cacheName, CachesFilter.DATA_MODES));
     }
 
     /** {@inheritDoc} */
-    @Override public final ClusterGroup forClientNodes(@Nullable String cacheName, @Nullable
String... cacheNames) {
-        return forPredicate(new CachesFilter(cacheName, cacheNames, CachesFilter.CLIENT_MODES));
+    @Override public final ClusterGroup forClientNodes(@Nullable String cacheName) {
+        return forPredicate(new CachesFilter(cacheName, CachesFilter.CLIENT_MODES));
     }
 
     /** {@inheritDoc} */
@@ -687,21 +687,15 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable
{
         /** Cache name. */
         private final String cacheName;
 
-        /** Cache names. */
-        private final String[] cacheNames;
-
         /** */
         private final Set<CacheDistributionMode> distributionMode;
 
         /**
          * @param cacheName Cache name.
-         * @param cacheNames Cache names.
          * @param distributionMode Filter by {@link CacheConfiguration#getDistributionMode()}.
          */
-        private CachesFilter(@Nullable String cacheName, @Nullable String[] cacheNames,
-            @Nullable Set<CacheDistributionMode> distributionMode) {
+        private CachesFilter(@Nullable String cacheName, @Nullable Set<CacheDistributionMode>
distributionMode) {
             this.cacheName = cacheName;
-            this.cacheNames = cacheNames;
             this.distributionMode = distributionMode;
         }
 
@@ -709,31 +703,12 @@ public class ClusterGroupAdapter implements ClusterGroupEx, Externalizable
{
         @Override public boolean apply(ClusterNode n) {
             GridCacheAttributes[] caches = n.attribute(ATTR_CACHE);
 
-            if (caches == null)
-                return false;
-
-            if (!hasCache(caches, cacheName, distributionMode))
-                return false;
-
-            if (!F.isEmpty(cacheNames))
-                for (String cn : cacheNames)
-                    if (!hasCache(caches, cn, distributionMode))
-                        return false;
-
-            return true;
-        }
-
-        /**
-         * @param cacheName Cache name to check.
-         * @param distributionMode Filter by {@link CacheConfiguration#getDistributionMode()}.
-         * @return {@code true} if given node has specified cache started.
-         */
-        public static boolean hasCache(GridCacheAttributes[] caches, @Nullable String cacheName,
-            @Nullable Collection<CacheDistributionMode> distributionMode) {
-            for (GridCacheAttributes attrs : caches) {
-                if (Objects.equals(cacheName, attrs.cacheName())
-                    && (distributionMode == null || distributionMode.contains(attrs.partitionedTaxonomy())))
-                    return true;
+            if (caches != null) {
+                for (GridCacheAttributes attrs : caches) {
+                    if (Objects.equals(cacheName, attrs.cacheName())
+                        && (distributionMode == null || distributionMode.contains(attrs.partitionedTaxonomy())))
+                        return true;
+                }
             }
 
             return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac80b233/modules/core/src/main/java/org/apache/ignite/internal/IgniteClusterAsyncImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteClusterAsyncImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteClusterAsyncImpl.java
index ee0c933..c0f8e83 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteClusterAsyncImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteClusterAsyncImpl.java
@@ -185,18 +185,18 @@ public class IgniteClusterAsyncImpl extends IgniteAsyncSupportAdapter<IgniteClus
     }
 
     /** {@inheritDoc} */
-    @Override public ClusterGroup forCacheNodes(String cacheName, @Nullable String... cacheNames)
{
-        return grid.forCacheNodes(cacheName, cacheNames);
+    @Override public ClusterGroup forCacheNodes(String cacheName) {
+        return grid.forCacheNodes(cacheName);
     }
 
     /** {@inheritDoc} */
-    @Override public ClusterGroup forDataNodes(String cacheName, @Nullable String... cacheNames)
{
-        return grid.forDataNodes(cacheName, cacheNames);
+    @Override public ClusterGroup forDataNodes(String cacheName) {
+        return grid.forDataNodes(cacheName);
     }
 
     /** {@inheritDoc} */
-    @Override public ClusterGroup forClientNodes(String cacheName, @Nullable String... cacheNames)
{
-        return grid.forClientNodes(cacheName, cacheNames);
+    @Override public ClusterGroup forClientNodes(String cacheName) {
+        return grid.forClientNodes(cacheName);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac80b233/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
index 7deb9e8..22dc618 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridProjectionForCachesSelfTest.java
@@ -34,7 +34,7 @@ import java.util.*;
 import static org.apache.ignite.cache.CacheMode.*;
 
 /**
- * Tests for {@link org.apache.ignite.cluster.ClusterGroup#forCacheNodes(String, String...)}
method.
+ * Tests for {@link org.apache.ignite.cluster.ClusterGroup#forCacheNodes(String)} method.
  */
 public class GridProjectionForCachesSelfTest extends GridCommonAbstractTest {
     /** */
@@ -142,21 +142,6 @@ public class GridProjectionForCachesSelfTest extends GridCommonAbstractTest
{
     /**
      * @throws Exception If failed.
      */
-    public void testProjectionForBothCaches() throws Exception {
-        ClusterGroup prj = ignite.cluster().forCacheNodes(null, CACHE_NAME);
-
-        assert prj != null;
-        assert prj.nodes().size() == 2;
-        assert !prj.nodes().contains(grid(0).localNode());
-        assert !prj.nodes().contains(grid(1).localNode());
-        assert prj.nodes().contains(grid(2).localNode());
-        assert prj.nodes().contains(grid(3).localNode());
-        assert !prj.nodes().contains(grid(4).localNode());
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
     public void testProjectionForDataCaches() throws Exception {
         ClusterGroup prj = ignite.cluster().forDataNodes(null);
 
@@ -179,16 +164,6 @@ public class GridProjectionForCachesSelfTest extends GridCommonAbstractTest
{
     /**
      * @throws Exception If failed.
      */
-    public void testProjectionForClientBothCaches() throws Exception {
-        ClusterGroup prj = ignite.cluster().forClientNodes(null, CACHE_NAME);
-
-        assert prj != null;
-        assert prj.nodes().isEmpty();
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
     public void testProjectionForWrongCacheName() throws Exception {
         ClusterGroup prj = ignite.cluster().forCacheNodes("wrong");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ac80b233/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/GridHadoopDefaultMapReducePlannerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/GridHadoopDefaultMapReducePlannerSelfTest.java
b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/GridHadoopDefaultMapReducePlannerSelfTest.java
index 93f38bb..87e0dbc 100644
--- a/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/GridHadoopDefaultMapReducePlannerSelfTest.java
+++ b/modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/GridHadoopDefaultMapReducePlannerSelfTest.java
@@ -1128,17 +1128,17 @@ public class GridHadoopDefaultMapReducePlannerSelfTest extends GridHadoopAbstrac
         }
 
         /** {@inheritDoc} */
-        @Override public ClusterGroup forCacheNodes(String cacheName, @Nullable String...
cacheNames) {
+        @Override public ClusterGroup forCacheNodes(String cacheName) {
             return null;
         }
 
         /** {@inheritDoc} */
-        @Override public ClusterGroup forDataNodes(String cacheName, @Nullable String...
cacheNames) {
+        @Override public ClusterGroup forDataNodes(String cacheName) {
             return null;
         }
 
         /** {@inheritDoc} */
-        @Override public ClusterGroup forClientNodes(String cacheName, @Nullable String...
cacheNames) {
+        @Override public ClusterGroup forClientNodes(String cacheName) {
             return null;
         }
 


Mime
View raw message