ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [27/50] [abbrv] ignite git commit: ignite-3054 - Small fixes
Date Mon, 24 Apr 2017 15:03:50 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/689f178f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/689f178f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/689f178f

Branch: refs/heads/ignite-3054
Commit: 689f178f3fc8f9fd62d3d49c980725af4e147fa4
Parents: 3d21809
Author: dkarachentsev <dkarachentsev@gridgain.com>
Authored: Mon Dec 12 10:47:42 2016 +0300
Committer: dkarachentsev <dkarachentsev@gridgain.com>
Committed: Mon Dec 12 10:47:42 2016 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 27 ++++++++++----------
 1 file changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/689f178f/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 0e92de5..f6d19e0 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
@@ -208,6 +208,9 @@ class ServerImpl extends TcpDiscoveryImpl {
     /** Node ID in GridNioSession. */
     private static final int NODE_ID_META = GridNioSessionMetaKey.nextUniqueKey();
 
+    /** ClientNioMessageWorker in GridNioSession. */
+    private static final int NIO_WORKER_META = GridNioSessionMetaKey.nextUniqueKey();
+
     /**
      * Number of tries to reopen ServerSocketChannel on 'SocketException: Invalid argument'.
      * <p>This error may happen on simultaneous server nodes startup on the same JVM.</p>
@@ -305,18 +308,12 @@ class ServerImpl extends TcpDiscoveryImpl {
                 log.debug("Stopping message worker on disconnect [remoteAddr=" + ses.remoteAddress()
+
                     ", remote node ID=" + clientNodeId + ']');
 
-            final ClientMessageProcessor proc = clientMsgWorkers.get(clientNodeId);
+            final ClientNioMessageWorker proc = ses.meta(NIO_WORKER_META);
 
-            if (proc != null && proc instanceof ClientNioMessageWorker &&
((ClientNioMessageWorker)proc).ses == ses) {
-                if (clientMsgWorkers.remove(clientNodeId, proc))
-                    ((ClientNioMessageWorker)proc).nonblockingStop();
-            }
-            else {
-                if (log.isDebugEnabled())
-                    log.error("Illegal ClientMessageProcessor: " + proc);
+            if (proc != null) {
+                clientMsgWorkers.remove(clientNodeId, proc);
 
-                if (ses.closeTime() == 0)
-                    ses.close();
+                proc.nonblockingStop();
             }
         }
 
@@ -5667,6 +5664,8 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             ses = clientNioSrv.createSession(ch, meta).get();
 
+            ses.addMeta(NIO_WORKER_META, this);
+
             state = WorkerState.STARTED;
         }
 
@@ -5710,6 +5709,8 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             nioWorkers.remove(this);
 
+            ses.removeMeta(NIO_WORKER_META);
+
             return res;
         }
 
@@ -5880,12 +5881,12 @@ class ServerImpl extends TcpDiscoveryImpl {
             final UUID nodeId = getConfiguredNodeId();
             final UUID clientNodeId = clientNodeId(ses);
 
-            final ClientNioMessageWorker clientMsgWrk = (ClientNioMessageWorker)clientMsgWorkers.get(clientNodeId);
+            final ClientNioMessageWorker clientMsgWrk = ses.meta(NIO_WORKER_META);
 
-            if (clientMsgWrk == null || clientMsgWrk.ses != ses) {
+            if (clientMsgWrk == null) {
                 if (log.isDebugEnabled())
                     log.debug("NIO Worker has been closed, drop message. [clientNodeId="
-                        + clientNodeId + ", message=" + msg + ", clientMsgWrk=" + clientMsgWrk
+ "]");
+                        + clientNodeId + ", message=" + msg + "]");
 
                 if (ses.closeTime() == 0)
                     ses.close();


Mime
View raw message