ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [25/50] incubator-ignite git commit: #ignite-716: Move Ignite Predicates to public static inner classes in CacheConfiguration.
Date Fri, 10 Apr 2015 13:07:04 GMT
#ignite-716: Move Ignite Predicates to public static inner classes in CacheConfiguration.


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

Branch: refs/heads/ignite-gg-9998
Commit: 4a2d41d924e97431bacec09d6e174fe0902edcdc
Parents: 2bc1c17
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Fri Apr 10 12:02:05 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Fri Apr 10 12:02:05 2015 +0300

----------------------------------------------------------------------
 .../configuration/CacheConfiguration.java       | 69 ++++++++++++--------
 1 file changed, 42 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4a2d41d9/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index bd3fac7..a744a43 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -27,7 +27,6 @@ import org.apache.ignite.cache.store.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;
-import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.plugin.*;
@@ -148,34 +147,10 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K,
V> {
     public static final boolean DFLT_READ_FROM_BACKUP = true;
 
     /** Filter that accepts only server nodes. */
-    public static final IgnitePredicate<ClusterNode> SERVER_NODES = new IgnitePredicate<ClusterNode>()
{
-        @Override public boolean apply(ClusterNode n) {
-            Boolean attr = n.attribute(IgniteNodeAttributes.ATTR_CLIENT_MODE);
-
-            return attr != null && !attr;
-        }
-
-        @Override public boolean equals(Object obj) {
-            if (obj == null)
-                return false;
-
-            return obj.getClass().equals(this.getClass());
-        }
-    };
+    public static final IgnitePredicate<ClusterNode> SERVER_NODES = new IgniteServerNodePredicate();
 
     /** Filter that accepts all nodes. */
-    public static final IgnitePredicate<ClusterNode> ALL_NODES = new IgnitePredicate<ClusterNode>()
{
-        @Override public boolean apply(ClusterNode clusterNode) {
-            return true;
-        }
-
-        @Override public boolean equals(Object obj) {
-            if (obj == null)
-                return false;
-
-            return obj.getClass().equals(this.getClass());
-        }
-    };
+    public static final IgnitePredicate<ClusterNode> ALL_NODES = new IgniteAllNodesPredicate();
 
     /** Default timeout after which long query warning will be printed. */
     public static final long DFLT_LONG_QRY_WARN_TIMEOUT = 3000;
@@ -1588,4 +1563,44 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K,
V> {
     @Override public String toString() {
         return S.toString(CacheConfiguration.class, this);
     }
+
+    /**
+     * Filter that accepts only server nodes.
+     */
+    public static class IgniteServerNodePredicate implements IgnitePredicate<ClusterNode>
{
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        @Override public boolean apply(ClusterNode n) {
+            Boolean attr = n.attribute(IgniteNodeAttributes.ATTR_CLIENT_MODE);
+
+            return attr != null && !attr;
+        }
+
+        @Override public boolean equals(Object obj) {
+            if (obj == null)
+                return false;
+
+            return obj.getClass().equals(this.getClass());
+        }
+    }
+
+    /**
+     *  Filter that accepts all nodes.
+     */
+    public static class IgniteAllNodesPredicate  implements IgnitePredicate<ClusterNode>
{
+        /** */
+        private static final long serialVersionUID = 0L;
+
+        @Override public boolean apply(ClusterNode clusterNode) {
+            return true;
+        }
+
+        @Override public boolean equals(Object obj) {
+            if (obj == null)
+                return false;
+
+            return obj.getClass().equals(this.getClass());
+        }
+    }
 }


Mime
View raw message