ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [2/3] ignite git commit: Optimized back-pressure control.
Date Fri, 04 Mar 2016 13:29:42 GMT
Optimized back-pressure control.


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

Branch: refs/heads/ignite-atomic-good-lock-bench
Commit: 673daf48b5a394c5a68dcf151cb13e6c09428928
Parents: 2d6c6c9
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Fri Mar 4 16:11:04 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Fri Mar 4 16:11:04 2016 +0300

----------------------------------------------------------------------
 .../util/nio/GridNioBackPressureControl.java       | 16 ++++++++++++++--
 .../org/apache/ignite/thread/IgniteThread.java     | 17 +++++++++++++++++
 2 files changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/673daf48/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioBackPressureControl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioBackPressureControl.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioBackPressureControl.java
index 96a1ab3..4d69533 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioBackPressureControl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioBackPressureControl.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.util.nio;
 
+import org.apache.ignite.thread.IgniteThread;
+
 /**
  * Utility class that allows to ignore back-pressure control for threads that are processing
messages.
  */
@@ -32,13 +34,23 @@ public class GridNioBackPressureControl {
      * @return Flag indicating whether current thread is processing message.
      */
     public static boolean threadProcessingMessage() {
-        return threadProcMsg.get();
+        Thread t = Thread.currentThread();
+
+        if (t instanceof IgniteThread)
+            return ((IgniteThread)t).processingMessage();
+        else
+            return threadProcMsg.get();
     }
 
     /**
      * @param processing Flag indicating whether current thread is processing message.
      */
     public static void threadProcessingMessage(boolean processing) {
-        threadProcMsg.set(processing);
+        Thread t = Thread.currentThread();
+
+        if (t instanceof IgniteThread)
+            ((IgniteThread)t).processingMessage(processing);
+        else
+            threadProcMsg.set(processing);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/673daf48/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java b/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java
index 03ed589..c7a3790 100644
--- a/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java
+++ b/modules/core/src/main/java/org/apache/ignite/thread/IgniteThread.java
@@ -48,6 +48,9 @@ public class IgniteThread extends Thread {
     /** Group index. */
     private final int grpIdx;
 
+    /** Message processing flag. */
+    private boolean procMsg;
+
     /**
      * Creates thread with given worker.
      *
@@ -126,6 +129,20 @@ public class IgniteThread extends Thread {
     }
 
     /**
+     * @return Message processing flag.
+     */
+    public boolean processingMessage() {
+        return procMsg;
+    }
+
+    /**
+     * @param procMsg Message processing flag.
+     */
+    public void processingMessage(boolean procMsg) {
+        this.procMsg = procMsg;
+    }
+
+    /**
      * Creates new thread name.
      *
      * @param num Thread number.


Mime
View raw message