ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [28/53] [abbrv] incubator-ignite git commit: IGNITE-49 Removed methods for working with meta data from ClusterNode interface. Fixed code style.
Date Tue, 27 Jan 2015 16:40:48 GMT
IGNITE-49 Removed methods for working with meta data from ClusterNode interface. Fixed code
style.


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

Branch: refs/heads/sprint-1
Commit: cafe7aba83c3b1cefb17ac70994ebc05dd3765a5
Parents: 16a56c5
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Mon Jan 26 14:40:48 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Mon Jan 26 14:40:48 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/cluster/ClusterNode.java  | 36 -------------------
 .../ignite/mbean/ClusterMetricsMxBean.java      |  4 +++
 .../near/GridCacheNearMultiNodeSelfTest.java    | 38 +++++++++++---------
 3 files changed, 25 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafe7aba/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
index 4180224..c593966 100644
--- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java
@@ -23,7 +23,6 @@ import org.apache.ignite.product.*;
 import org.jetbrains.annotations.*;
 
 import java.util.*;
-import java.util.concurrent.*;
 
 /**
  * Interface representing a single grid node. Use {@link #attribute(String)} or
@@ -254,39 +253,4 @@ public interface ClusterNode {
      * @return {@code True} if this node is a client node, {@code false} otherwise.
      */
     public boolean isClient();
-
-    /**
-     * Adds a new metadata.
-     *
-     * @param name Metadata name.
-     * @param val Metadata value.
-     * @param <V> Type of the value.
-     * @return Metadata previously associated with given name, or
-     *      {@code null} if there was none.
-     */
-    @Nullable public <V> V addMeta(String name, V val);
-
-    /**
-     * Adds given metadata value only if it was absent.
-     *
-     * @param name Metadata name.
-     * @param c Factory closure to produce value to add if it's not attached already.
-     *      Not that unlike {@link #addMeta(String, Object)} method the factory closure will
-     *      not be called unless the value is required and therefore value will only be created
-     *      when it is actually needed. If {@code null} and metadata value is missing - {@code
null}
-     *      will be returned from this method.
-     * @param <V> Type of the value.
-     * @return The value of the metadata after execution of this method.
-     */
-    @Nullable public <V> V addMetaIfAbsent(String name, @Nullable Callable<V>
c);
-
-
-    /**
-     * Gets metadata by name.
-     *
-     * @param name Metadata name.
-     * @param <V> Type of the value.
-     * @return Metadata value or {@code null}.
-     */
-    @Nullable public <V> V meta(String name);
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafe7aba/modules/core/src/main/java/org/apache/ignite/mbean/ClusterMetricsMxBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mbean/ClusterMetricsMxBean.java
b/modules/core/src/main/java/org/apache/ignite/mbean/ClusterMetricsMxBean.java
index 023993c..9249a73 100644
--- a/modules/core/src/main/java/org/apache/ignite/mbean/ClusterMetricsMxBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/mbean/ClusterMetricsMxBean.java
@@ -234,4 +234,8 @@ public interface ClusterMetricsMxBean extends ClusterMetrics {
     @IgniteMBeanDescription("Outbound messages queue size.")
     public int getOutboundMessagesQueueSize();
 
+    /** {@inheritDoc} */
+    @IgniteMBeanDescription("Start time of the grid node in milliseconds.")
+    @Override long getNodeStartTime();
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/cafe7aba/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
index bf766e3..926db5e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
@@ -211,9 +211,19 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest
{
     }
 
     /** @param cnt Count. */
-    private void mapKeys(int cnt) {
+    private Map<UUID, T2<Set<Integer>, Set<Integer>>> mapKeys(int
cnt) {
         CacheAffinity<Object> aff = affinity(0);
 
+        //Mapping primary and backup keys on node
+        Map<UUID, T2<Set<Integer>, Set<Integer>>> map = new HashMap<>();
+
+        for (int i = 0; i < GRID_CNT; i++) {
+            GridEx grid = grid(i);
+
+            map.put(grid.cluster().localNode().id(), new T2<Set<Integer>, Set<Integer>>(new
HashSet<Integer>(),
+                new HashSet<Integer>()));
+        }
+
         for (int key = 1; key <= cnt; key++) {
             Integer part = aff.partition(key);
 
@@ -223,41 +233,35 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest
{
 
             ClusterNode primary = F.first(nodes);
 
-            Set<Integer> keys = primary.addMetaIfAbsent("primary", F.<Integer>newSet());
-
-            assert keys != null;
-
-            keys.add(key);
+            map.get(primary.id()).get1().add(key);
 
             if (mapDebug)
                 info("Mapped key to primary node [key=" + key + ", node=" + U.toShortString(primary));
 
             for (ClusterNode n : nodes) {
                 if (n != primary) {
-                    keys = n.addMetaIfAbsent("backups", F.<Integer>newSet());
-
-                    assert keys != null;
-
-                    keys.add(key);
+                    map.get(n.id()).get2().add(key);
 
                     if (mapDebug)
                         info("Mapped key to backup node [key=" + key + ", node=" + U.toShortString(n));
                 }
             }
         }
+
+        return map;
     }
 
-    /** Test mappings. */
+    /**  Test mappings. */
     public void testMappings() {
         mapDebug = false;
 
         int cnt = 100000;
 
-        mapKeys(cnt);
+        Map<UUID, T2<Set<Integer>, Set<Integer>>> map = mapKeys(cnt);
 
         for (ClusterNode n : grid(0).nodes()) {
-            Set<Integer> primary = n.meta("primary");
-            Set<Integer> backups = n.meta("backups");
+            Set<Integer> primary = map.get(n.id()).get1();
+            Set<Integer> backups = map.get(n.id()).get2();
 
             if (backups == null)
                 backups = Collections.emptySet();
@@ -340,7 +344,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest
{
 
         int cnt = 10;
 
-        mapKeys(cnt);
+        Map<UUID, T2<Set<Integer>, Set<Integer>>> mapKeys = mapKeys(cnt);
 
         for (int key = 1; key <= cnt; key++) {
             String s = near.get(key);
@@ -359,7 +363,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest
{
 
             assert n != null;
 
-            assert ((Collection)n.meta("primary")).contains(key);
+            assert mapKeys.get(n.id()).get1().contains(key);
 
             GridCache<Integer, String> dhtCache = dht(G.ignite(n.id()));
 


Mime
View raw message