ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-comm-balance
Date Tue, 06 Dec 2016 09:59:45 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-comm-balance-master d756f6799 -> b4d9a22d0


ignite-comm-balance


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

Branch: refs/heads/ignite-comm-balance-master
Commit: b4d9a22d0232aeb493bb955efd4a5660e5ed058b
Parents: d756f67
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Dec 6 12:59:38 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Dec 6 12:59:38 2016 +0300

----------------------------------------------------------------------
 .../internal/util/nio/GridCommunicationClient.java       |  4 ++--
 .../apache/ignite/internal/util/nio/GridNioServer.java   |  6 +++---
 .../internal/util/nio/GridSelectorNioSessionImpl.java    |  8 --------
 .../spi/communication/tcp/TcpCommunicationSpi.java       | 11 ++++++++---
 ...GridTcpCommunicationSpiConcurrentConnectSelfTest.java |  2 +-
 5 files changed, 14 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/b4d9a22d/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridCommunicationClient.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridCommunicationClient.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridCommunicationClient.java
index 312a20e..71b2c24 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridCommunicationClient.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridCommunicationClient.java
@@ -96,11 +96,11 @@ public interface GridCommunicationClient {
     /**
      * @param nodeId Remote node ID. Provided only for sync clients.
      * @param msg Message to send.
-     * @param closure Ack closure.
+     * @param c Ack closure.
      * @throws IgniteCheckedException If failed.
      * @return {@code True} if should try to resend message.
      */
-    public boolean sendMessage(@Nullable UUID nodeId, Message msg, @Nullable IgniteInClosure<IgniteException>
closure)
+    public boolean sendMessage(@Nullable UUID nodeId, Message msg, @Nullable IgniteInClosure<IgniteException>
c)
         throws IgniteCheckedException;
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4d9a22d/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index e1a57b1..4dd03a1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -250,7 +250,7 @@ public class GridNioServer<T> {
      * @param writerFactory Writer factory.
      * @param skipRecoveryPred Skip recovery predicate.
      * @param msgQueueLsnr Message queue size listener.
-     * @param balancing Balancing flag.
+     * @param balancing NIO sessions balancing flag.
      * @param filters Filters for this server.
      * @throws IgniteCheckedException If failed.
      */
@@ -3124,7 +3124,7 @@ public class GridNioServer<T> {
         /** */
         private long selectorSpins;
 
-        /** */
+        /** NIO sessions balancing flag. */
         private boolean balancing;
 
         /**
@@ -3169,7 +3169,7 @@ public class GridNioServer<T> {
         }
 
         /**
-         * @param balancing Balancing flag.
+         * @param balancing NIO sessions balancing flag.
          * @return This for chaining.
          */
         public Builder<T> balancing(boolean balancing) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4d9a22d/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
index 2d2fe47..66f9176 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
@@ -175,8 +175,6 @@ class GridSelectorNioSessionImpl extends GridNioSessionImpl {
      */
     boolean offerMove(GridNioWorker from, GridNioServer.SessionChangeRequest fut) {
         synchronized (this) {
-            // U.debug(log, "Offered move [ses=" + this + ", fut=" + fut + ']');
-
             if (log.isDebugEnabled())
                 log.debug("Offered move [ses=" + this + ", fut=" + fut + ']');
 
@@ -196,8 +194,6 @@ class GridSelectorNioSessionImpl extends GridNioSessionImpl {
      */
     void offerStateChange(GridNioServer.SessionChangeRequest fut) {
         synchronized (this) {
-            // U.debug(log, "Offered change [ses=" + this + ", fut=" + fut + ']');
-
             if (log.isDebugEnabled())
                 log.debug("Offered move [ses=" + this + ", fut=" + fut + ']');
 
@@ -221,8 +217,6 @@ class GridSelectorNioSessionImpl extends GridNioSessionImpl {
         synchronized (this) {
             assert this.worker == moveFrom;
 
-            // U.debug(log, "Started moving [ses=" + this + ", from=" + moveFrom + ']');
-
             if (log.isDebugEnabled())
                 log.debug("Started moving [ses=" + this + ", from=" + moveFrom + ']');
 
@@ -246,8 +240,6 @@ class GridSelectorNioSessionImpl extends GridNioSessionImpl {
         synchronized (this) {
             assert worker == null;
 
-            // U.debug(log, "Finishing moving [ses=" + this + ", to=" + moveTo + ']');
-
             if (log.isDebugEnabled())
                 log.debug("Finishing moving [ses=" + this + ", to=" + moveTo + ']');
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4d9a22d/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 58ceffa..74d29b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -533,10 +533,12 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                         curClients = clients.get(sndId);
 
                         oldClient = curClients != null && connKey.connectionIndex()
< curClients.length ?
-                            curClients[0] : null;
+                            curClients[connKey.connectionIndex()] : null;
 
                         if (oldClient != null) {
                             if (oldClient instanceof GridTcpNioCommunicationClient) {
+                                assert oldClient.connectionIndex() == connKey.connectionIndex()
: oldClient;
+
                                 if (log.isDebugEnabled())
                                     log.debug("Received incoming connection when already
connected " +
                                         "to this node, rejecting [locNode=" + locNode.id()
+
@@ -723,7 +725,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                 GridTcpNioCommunicationClient client = null;
 
                 if (createClient) {
-                    client = new GridTcpNioCommunicationClient(0, ses, log);
+                    client = new GridTcpNioCommunicationClient(connKey.connectionIndex(),
ses, log);
 
                     addNodeClient(node, connKey.connectionIndex(), client);
                 }
@@ -1763,7 +1765,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
         if (connectionsPerNode > 1) {
             connPlc = new ConnectionPolicy() {
                 @Override public int connectionIndex() {
-                    return (int)(Thread.currentThread().getId() % connectionsPerNode);
+                    return (int)(U.safeAbs(Thread.currentThread().getId()) % connectionsPerNode);
                 }
             };
         }
@@ -2392,6 +2394,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
      */
     private void addNodeClient(ClusterNode node, int connIdx, GridCommunicationClient addClient)
{
         assert connectionsPerNode > 0 : connectionsPerNode;
+        assert connIdx == addClient.connectionIndex() : addClient;
 
         if (connIdx >= connectionsPerNode) {
             assert !usePairedConnections(node);
@@ -2514,6 +2517,8 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter
                 }
             }
 
+            assert connIdx == client.connectionIndex() : client;
+
             if (client.reserve())
                 return client;
             else

http://git-wip-us.apache.org/repos/asf/ignite/blob/b4d9a22d/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
index e1c317d..a649130 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridTcpCommunicationSpiConcurrentConnectSelfTest.java
@@ -88,7 +88,7 @@ public class GridTcpCommunicationSpiConcurrentConnectSelfTest<T extends
Communic
     private int connectionsPerNode = 1;
 
     /** */
-    private boolean pairedConnections;
+    private boolean pairedConnections = true;
 
     /**
      *


Mime
View raw message