ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: io
Date Mon, 10 Oct 2016 10:18:38 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-comm-opts2 cf32e4593 -> 35ea9ea8e


io


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

Branch: refs/heads/ignite-comm-opts2
Commit: 35ea9ea8e4465fc0663170b0d8d20325ad3c361a
Parents: cf32e45
Author: sboikov <sboikov@gridgain.com>
Authored: Mon Oct 10 13:16:40 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Mon Oct 10 13:16:40 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/nio/GridNioServer.java | 29 ++++++++++++++------
 1 file changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/35ea9ea8/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 45f5f8c..8f231d0 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
@@ -1398,6 +1398,9 @@ public class GridNioServer<T> {
         /** Worker index. */
         private final int idx;
 
+        /** {@code True} if calls 'selector.select'. */
+        private volatile boolean select;
+
         /**
          * @param idx Index of this worker in server's array.
          * @param gridName Grid name.
@@ -1498,7 +1501,8 @@ public class GridNioServer<T> {
         private void offer(SessionChangeRequest req) {
             changeReqs.offer(req);
 
-            selector.wakeup();
+            if (select)
+                selector.wakeup();
         }
 
         /**
@@ -1595,13 +1599,22 @@ public class GridNioServer<T> {
                         }
                     }
 
-                    // Wake up every 2 seconds to check if closed.
-                    if (selector.select(2000) > 0) {
-                        // Walk through the ready keys collection and process network events.
-                        if (selectedKeys == null)
-                            processSelectedKeys(selector.selectedKeys());
-                        else
-                            processSelectedKeysOptimized(selectedKeys.flip());
+                    select = true;
+
+                    try {
+                        if (changeReqs.isEmpty()) {
+                            // Wake up every 2 seconds to check if closed.
+                            if (selector.select(2000) > 0) {
+                                // Walk through the ready keys collection and process network
events.
+                                if (selectedKeys == null)
+                                    processSelectedKeys(selector.selectedKeys());
+                                else
+                                    processSelectedKeysOptimized(selectedKeys.flip());
+                            }
+                        }
+                    }
+                    finally {
+                        select = false;
                     }
 
                     long now = U.currentTimeMillis();


Mime
View raw message