This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new e0da301  Align code with 8.5.x
e0da301 is described below

commit e0da30190820b5576dc497cdc6c012782d73e85b
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Feb 19 17:04:02 2021 +0000

    Align code with 8.5.x
---
 java/org/apache/tomcat/util/net/NioBlockingSelector.java |  2 +-
 java/org/apache/tomcat/util/net/NioSelectorPool.java     | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/NioBlockingSelector.java 
b/java/org/apache/tomcat/util/net/NioBlockingSelector.java
index 67d6a53..a60b7aa 100644
--- a/java/org/apache/tomcat/util/net/NioBlockingSelector.java
+++ b/java/org/apache/tomcat/util/net/NioBlockingSelector.java
@@ -68,7 +68,7 @@ public class NioBlockingSelector {
     }
 
     /**
-     * Performs a blocking write using the byte buffer for data to be written
+     * Performs a blocking write using the bytebuffer for data to be written
      * If the <code>selector</code> parameter is null, then it will perform a 
busy write that could
      * take up a lot of CPU cycles.
      *
diff --git a/java/org/apache/tomcat/util/net/NioSelectorPool.java 
b/java/org/apache/tomcat/util/net/NioSelectorPool.java
index e3d88f6..c557f06 100644
--- a/java/org/apache/tomcat/util/net/NioSelectorPool.java
+++ b/java/org/apache/tomcat/util/net/NioSelectorPool.java
@@ -96,8 +96,7 @@ public class NioSelectorPool {
         if (enabled) {
             active.decrementAndGet();
         }
-        if (enabled && (maxSpareSelectors == -1
-                || spare.get() < Math.min(maxSpareSelectors, maxSelectors))) {
+        if (enabled && (maxSpareSelectors == -1 || spare.get() < 
Math.min(maxSpareSelectors, maxSelectors))) {
             spare.incrementAndGet();
             selectors.offer(s);
         } else {
@@ -264,8 +263,9 @@ public class NioSelectorPool {
                     //register OP_WRITE to the selector
                     if (key == null) {
                         key = socket.getIOChannel().register(selector, 
SelectionKey.OP_READ);
+                    } else {
+                        key.interestOps(SelectionKey.OP_READ);
                     }
-                    else key.interestOps(SelectionKey.OP_READ);
                     if (readTimeout == 0) {
                         timedout = (read == 0);
                     } else if (readTimeout < 0) {
@@ -274,7 +274,7 @@ public class NioSelectorPool {
                         keycount = selector.select(readTimeout);
                     }
                 }
-                if (readTimeout > 0 && (selector == null || keycount == 0) ) {
+                if (readTimeout > 0 && (selector == null || keycount == 0)) {
                     timedout = (System.currentTimeMillis() - time) >= 
readTimeout;
                 }
             }
@@ -339,4 +339,4 @@ public class NioSelectorPool {
     public void setShared(boolean shared) {
         this.shared = shared;
     }
-}
\ No newline at end of file
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to