ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [03/50] incubator-ignite git commit: gg-10115: fix Client connector.
Date Mon, 27 Apr 2015 12:30:02 GMT
gg-10115: fix Client connector.


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

Branch: refs/heads/ignite-648
Commit: 8e31b7c32c18ee641bfc6f5751a5acb4ba92375f
Parents: 7c9fab3
Author: Artem Shutak <ashutak@gridgain.com>
Authored: Wed Apr 22 19:13:52 2015 +0300
Committer: Artem Shutak <ashutak@gridgain.com>
Committed: Wed Apr 22 19:13:52 2015 +0300

----------------------------------------------------------------------
 .../client/impl/connection/GridClientNioTcpConnection.java  | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8e31b7c3/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
index 1f70385..d247e05 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/client/impl/connection/GridClientNioTcpConnection.java
@@ -40,6 +40,7 @@ import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 import java.util.logging.*;
 
+import static java.util.concurrent.TimeUnit.*;
 import static org.apache.ignite.internal.client.GridClientCacheFlag.*;
 import static org.apache.ignite.internal.client.impl.connection.GridClientConnectionCloseReason.*;
 import static org.apache.ignite.internal.processors.rest.client.message.GridClientCacheRequest.GridCacheOperation.*;
@@ -164,8 +165,12 @@ public class GridClientNioTcpConnection extends GridClientConnection
{
             sock.setTcpNoDelay(tcpNoDelay);
             sock.setKeepAlive(true);
 
+            final long startConnTime = U.currentTimeMillis();
+
             sock.connect(srvAddr, connectTimeout);
 
+            final long connTimeoutRest = connectTimeout - (U.currentTimeMillis() - startConnTime);
+
             GridClientFuture<?> handshakeFut = new GridClientFutureAdapter<>();
 
             Map<Integer, Object> meta = new HashMap<>();
@@ -199,7 +204,7 @@ public class GridClientNioTcpConnection extends GridClientConnection {
 
             ses.send(req);
 
-            handshakeFut.get();
+            handshakeFut.get(connTimeoutRest, MILLISECONDS);
 
             ses.addMeta(SES_META_CONN, this);
 
@@ -215,7 +220,7 @@ public class GridClientNioTcpConnection extends GridClientConnection {
                         log.warning("Failed to send ping message: " + e);
                     }
                 }
-            }, 500, 500, TimeUnit.MILLISECONDS);
+            }, 500, 500, MILLISECONDS);
 
             createTs = System.currentTimeMillis();
 


Mime
View raw message