ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [26/50] [abbrv] ignite git commit: ignite-3054 - Small fixes
Date Mon, 24 Apr 2017 15:03:49 GMT
ignite-3054 - Small fixes


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

Branch: refs/heads/ignite-3054
Commit: 3d21809857ccb7352918ceaee549e491c678e0bc
Parents: d46f0ac
Author: dkarachentsev <dkarachentsev@gridgain.com>
Authored: Mon Dec 12 10:25:39 2016 +0300
Committer: dkarachentsev <dkarachentsev@gridgain.com>
Committed: Mon Dec 12 10:25:39 2016 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ClientImpl.java      | 18 +++++++++++++++++-
 .../ignite/spi/discovery/tcp/ServerImpl.java      |  2 ++
 2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3d218098/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
index 00cba42..f3b9ba7 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ClientImpl.java
@@ -969,6 +969,8 @@ class ClientImpl extends TcpDiscoveryImpl {
 
                         boolean ack = msg instanceof TcpDiscoveryClientAckResponse;
 
+                        sockWriter.messageReceived();
+
                         if (!ack)
                             msgWorker.addMessage(msg);
                         else
@@ -1020,6 +1022,9 @@ class ClientImpl extends TcpDiscoveryImpl {
         /** */
         private boolean writeLen;
 
+        /** */
+        private volatile long lastMsgReceived;
+
         /**
          *
          */
@@ -1084,6 +1089,13 @@ class ClientImpl extends TcpDiscoveryImpl {
             }
         }
 
+        /**
+         * Updates timeout when message received.
+         */
+        void messageReceived() {
+            lastMsgReceived = U.currentTimeMillis();
+        }
+
         /** {@inheritDoc} */
         @Override protected void body() throws InterruptedException {
             TcpDiscoveryAbstractMessage msg = null;
@@ -1138,9 +1150,13 @@ class ClientImpl extends TcpDiscoveryImpl {
                         TcpDiscoveryAbstractMessage unacked;
 
                         synchronized (mux) {
-                            while (unackedMsg != null && U.currentTimeMillis() <
waitEnd)
+                            while (unackedMsg != null && U.currentTimeMillis() <
waitEnd) {
                                 mux.wait(waitEnd);
 
+                                waitEnd = lastMsgReceived + (spi.failureDetectionTimeoutEnabled()
?
+                                    spi.failureDetectionTimeout() : spi.getAckTimeout());
+                            }
+
                             unacked = unackedMsg;
 
                             unackedMsg = null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3d218098/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index e1798b5..0e92de5 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -7777,6 +7777,8 @@ class ServerImpl extends TcpDiscoveryImpl {
                     }
                 }
 
+                nioSem.drainPermits();
+
                 nioSem.tryAcquire(1000, TimeUnit.MILLISECONDS);
             }
         }


Mime
View raw message