ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [19/50] [abbrv] ignite git commit: fixing TC - ssl tests
Date Mon, 05 Dec 2016 14:41:41 GMT
fixing TC - ssl tests


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

Branch: refs/heads/ignite-comm-balance-master
Commit: 0279404e7e2ad0990c91c34aaba60094c6bc0a2e
Parents: fdbf90a
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Fri Nov 11 20:18:03 2016 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Fri Nov 11 20:18:03 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/nio/GridNioServer.java | 37 ++++++++++++++------
 .../ignite/internal/util/nio/GridNioWorker.java |  5 +++
 2 files changed, 31 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0279404e/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 dd0a515..b746488 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
@@ -973,8 +973,15 @@ public class GridNioServer<T> {
                         if (ses.procWrite.get()) {
                             ses.procWrite.set(false);
 
-                            if (ses.writeQueue().isEmpty())
-                                key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
+                            if (ses.writeQueue().isEmpty()) {
+                                if ((key.interestOps() & SelectionKey.OP_WRITE) != 0)
{
+                                    key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
+
+                                    writeSesCnt--;
+
+                                    assert writeSesCnt >= 0;
+                                }
+                            }
                             else
                                 ses.procWrite.set(true);
                         }
@@ -1021,6 +1028,11 @@ public class GridNioServer<T> {
                 }
             }
         }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(ByteBufferNioClientWorker.class, this, super.toString());
+        }
     }
 
     /**
@@ -1220,11 +1232,18 @@ public class GridNioServer<T> {
                             req = ses.pollFuture();
 
                             if (req == null && buf.position() == 0) {
-                                if (ses.procWrite.get()) {
+                                if (!this.writer || ses.procWrite.get()) {
                                     ses.procWrite.set(false);
 
-                                    if (ses.writeQueue().isEmpty())
-                                        key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
+                                    if (ses.writeQueue().isEmpty()) {
+                                        if ((key.interestOps() & SelectionKey.OP_WRITE)
!= 0) {
+                                            key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
+
+                                            writeSesCnt--;
+
+                                            assert writeSesCnt >= 0 : writeSesCnt;
+                                        }
+                                    }
                                     else
                                         ses.procWrite.set(true);
                                 }
@@ -1958,7 +1977,7 @@ public class GridNioServer<T> {
         /**
          * @param ses Session.
          */
-        final void registerWrite(GridSelectorNioSessionImpl ses) {
+        public final void registerWrite(GridSelectorNioSessionImpl ses) {
             SelectionKey key = ses.key();
 
             if (key.isValid()) {
@@ -2044,7 +2063,6 @@ public class GridNioServer<T> {
                     }
                 }
 
-
                 sb.append("]").append(U.nl());
             }
 
@@ -3106,10 +3124,7 @@ public class GridNioServer<T> {
 
                     queue.offer((ByteBuffer)msg);
 
-                    SelectionKey key = ((GridSelectorNioSessionImpl)ses).key();
-
-                    if (key.isValid())
-                        key.interestOps(key.interestOps() | SelectionKey.OP_WRITE);
+                    ((GridSelectorNioSessionImpl)ses).worker().registerWrite((GridSelectorNioSessionImpl)ses);
 
                     return null;
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/0279404e/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioWorker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioWorker.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioWorker.java
index 3419b4c..62985ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioWorker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioWorker.java
@@ -40,4 +40,9 @@ interface GridNioWorker {
      * @return Session state change requests.
      */
     @Nullable public List<GridNioServer.SessionChangeRequest> clearSessionRequests(GridNioSession
ses);
+
+    /**
+     * @param ses Session to register write interest for.
+     */
+    public void registerWrite(GridSelectorNioSessionImpl ses);
 }


Mime
View raw message