ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [01/50] [abbrv] ignite git commit: fixes for SPIN=0
Date Mon, 05 Dec 2016 14:41:23 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-comm-balance-master [created] 2f1828e25


fixes for SPIN=0


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

Branch: refs/heads/ignite-comm-balance-master
Commit: ec248573135b7c84834230bb7e707a67f485e2ef
Parents: 3d0e1bc
Author: Yakov Zhdanov <yzhdanov@gridgain.com>
Authored: Fri Oct 28 20:31:05 2016 +0300
Committer: Yakov Zhdanov <yzhdanov@gridgain.com>
Committed: Fri Oct 28 20:31:05 2016 +0300

----------------------------------------------------------------------
 .../ignite/internal/util/StripedExecutor.java   | 30 ++++++++++++++++++++
 .../ignite/internal/util/nio/GridNioServer.java |  8 +++---
 2 files changed, 34 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ec248573/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
index b8510e1..e6576d4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/StripedExecutor.java
@@ -18,7 +18,9 @@
 package org.apache.ignite.internal.util;
 
 import java.util.Queue;
+import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.locks.LockSupport;
 import org.apache.ignite.IgniteInterruptedException;
 import org.apache.ignite.IgniteLogger;
@@ -293,4 +295,32 @@ public class StripedExecutor {
             return S.toString(StripeConcurrentQueue.class, this, super.toString());
         }
     }
+
+    /**
+     * Stripe.
+     */
+    private static class StripeConcurrentBlockingQueue extends Stripe {
+        /** Queue. */
+        private final BlockingQueue<Runnable> queue = new LinkedBlockingQueue<>();
+
+        /** {@inheritDoc} */
+        @Override Runnable take() throws InterruptedException {
+            return queue.take();
+        }
+
+        /** {@inheritDoc} */
+        void execute(Runnable cmd) {
+            queue.add(cmd);
+        }
+
+        /** {@inheritDoc} */
+        @Override int queueSize() {
+            return queue.size();
+        }
+
+        /** {@inheritDoc} */
+        @Override public String toString() {
+            return S.toString(StripeConcurrentBlockingQueue.class, this, super.toString());
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/ec248573/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 10ab038..58b41f9 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
@@ -1661,7 +1661,7 @@ public class GridNioServer<T> {
 
             if (select)
                 selector.wakeup();
-            else if (park)
+            else if (!DISABLE_PARK && park)
                 LockSupport.unpark(clientThreads[idx]);
         }
 
@@ -1872,14 +1872,14 @@ public class GridNioServer<T> {
                             processSelectedKeysOptimized(selectedKeys.flip());
                     }
 
-                    if ((!changeReqs.isEmpty() || (!DISABLE_PARK && writer &&
pendingAcks == 0)) &&
-                        SELECTOR_SPINS != 0)
+                    if (!changeReqs.isEmpty() ||
+                        (!DISABLE_PARK && writer && pendingAcks == 0 &&
SELECTOR_SPINS != 0))
                         continue;
 
                     select = true;
 
                     try {
-                        if (!changeReqs.isEmpty() && SELECTOR_SPINS != 0)
+                        if (!changeReqs.isEmpty())
                             continue;
 
                         // Wake up every 2 seconds to check if closed.


Mime
View raw message