You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2019/04/15 18:30:11 UTC

[tomcat] branch master updated: Drop sync experiment

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

remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new ac53f55  Drop sync experiment
ac53f55 is described below

commit ac53f551f78788dccf554d05a7aa2fa0f7b5c85c
Author: remm <re...@apache.org>
AuthorDate: Mon Apr 15 20:29:59 2019 +0200

    Drop sync experiment
---
 java/org/apache/tomcat/util/net/NioEndpoint.java | 56 ++++++++++++------------
 1 file changed, 27 insertions(+), 29 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 3fc5564..97bd44a 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1459,38 +1459,36 @@ public class NioEndpoint extends AbstractJsseEndpoint<NioChannel,SocketChannel>
 
             @Override
             public void run() {
-                synchronized (semaphore) {
-                    // Perform the IO operation
-                    // Called from the poller to continue the IO operation
-                    long nBytes = 0;
-                    if (getError() == null) {
-                        try {
-                            if (read) {
-                                nBytes = getSocket().read(buffers, offset, length);
-                            } else {
-                                nBytes = getSocket().write(buffers, offset, length);
-                            }
-                        } catch (IOException e) {
-                            setError(e);
-                        }
-                    }
-                    if (nBytes > 0) {
-                        // The bytes read are only updated in the completion handler
-                        completion.completed(Long.valueOf(nBytes), this);
-                    } else if (nBytes < 0 || getError() != null) {
-                        IOException error = getError();
-                        if (error == null) {
-                            error = new EOFException();
-                        }
-                        completion.failed(error, this);
-                    } else {
-                        // As soon as the operation uses the poller, it is no longer inline
-                        inline = false;
+                // Perform the IO operation
+                // Called from the poller to continue the IO operation
+                long nBytes = 0;
+                if (getError() == null) {
+                    try {
                         if (read) {
-                            registerReadInterest();
+                            nBytes = getSocket().read(buffers, offset, length);
                         } else {
-                            registerWriteInterest();
+                            nBytes = getSocket().write(buffers, offset, length);
                         }
+                    } catch (IOException e) {
+                        setError(e);
+                    }
+                }
+                if (nBytes > 0) {
+                    // The bytes read are only updated in the completion handler
+                    completion.completed(Long.valueOf(nBytes), this);
+                } else if (nBytes < 0 || getError() != null) {
+                    IOException error = getError();
+                    if (error == null) {
+                        error = new EOFException();
+                    }
+                    completion.failed(error, this);
+                } else {
+                    // As soon as the operation uses the poller, it is no longer inline
+                    inline = false;
+                    if (read) {
+                        registerReadInterest();
+                    } else {
+                        registerWriteInterest();
                     }
                 }
             }


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