ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ivasilin...@apache.org
Subject [1/2] incubator-ignite git commit: #ignite-1109: sort addresses for consistentId in TcpDiscoveryNode constructor.
Date Thu, 09 Jul 2015 09:41:40 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-1109 [created] 4f8558673


#ignite-1109: sort addresses for consistentId in TcpDiscoveryNode constructor.


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

Branch: refs/heads/ignite-1109
Commit: 98b6487d7fa26bb5e65df60f0b324828d71b350a
Parents: c134dcf
Author: ivasilinets <ivasilinets@gridgain.com>
Authored: Thu Jul 9 11:40:41 2015 +0300
Committer: ivasilinets <ivasilinets@gridgain.com>
Committed: Thu Jul 9 11:40:41 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/internal/util/IgniteUtils.java |  6 +-----
 .../spi/discovery/tcp/internal/TcpDiscoveryNode.java      | 10 ++++++----
 2 files changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/98b6487d/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 46a23d6..f457d6c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -8048,13 +8048,9 @@ public abstract class IgniteUtils {
     public static String consistentId(Collection<String> addrs, int port) {
         assert !F.isEmpty(addrs);
 
-        List<String> sortedAddrs = new ArrayList<>(addrs);
-
-        Collections.sort(sortedAddrs);
-
         StringBuilder sb = new StringBuilder();
 
-        for (String addr : sortedAddrs)
+        for (String addr : addrs)
             sb.append(addr).append(',');
 
         sb.delete(sb.length() - 1, sb.length());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/98b6487d/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
index 4b4df45..ed954af 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java
@@ -143,14 +143,16 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements
Cluste
         assert ver != null;
 
         this.id = id;
-        this.addrs = addrs;
+
+        List<String> sortedAddrs = new ArrayList<>(addrs);
+        Collections.sort(sortedAddrs);
+
+        this.addrs = sortedAddrs;
         this.hostNames = hostNames;
         this.discPort = discPort;
         this.metricsProvider = metricsProvider;
         this.ver = ver;
-
-        consistentId = U.consistentId(addrs, discPort);
-
+        consistentId = U.consistentId(sortedAddrs, discPort);
         metrics = metricsProvider.metrics();
         cacheMetrics = metricsProvider.cacheMetrics();
         sockAddrs = U.toSocketAddresses(this, discPort);


Mime
View raw message