This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new a1dc9b0 Cleanups
a1dc9b0 is described below
commit a1dc9b09305705f3bdd29504f7d5c8d2b76bd45f
Author: remm <[email protected]>
AuthorDate: Wed Mar 27 22:42:41 2019 +0100
Cleanups
---
java/org/apache/tomcat/util/net/Nio2Endpoint.java | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index c38dc70..0432198 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -701,22 +701,22 @@ public class Nio2Endpoint extends
AbstractJsseEndpoint<Nio2Channel> {
@Override
public boolean isReadyForRead() throws IOException {
synchronized (readCompletionHandler) {
+ // A notification has been sent, it is possible to read at
least once
if (readNotify) {
return true;
}
-
+ // If a read is pending, reading is not possible until a
notification is sent
if (!readPending.tryAcquire()) {
readInterest = true;
return false;
}
-
+ // It is possible to read directly from the buffer contents
if (!socketBufferHandler.isReadBufferEmpty()) {
readPending.release();
return true;
}
-
- int nRead = fillReadBuffer(false);
- boolean isReady = nRead > 0;
+ // Try to read some data
+ boolean isReady = fillReadBuffer(false) > 0;
if (!isReady) {
readInterest = true;
}
@@ -728,20 +728,21 @@ public class Nio2Endpoint extends
AbstractJsseEndpoint<Nio2Channel> {
@Override
public boolean isReadyForWrite() {
synchronized (writeCompletionHandler) {
+ // A notification has been sent, it is possible to write at
least once
if (writeNotify) {
return true;
}
-
+ // If a write is pending, writing is not possible until a
notification is sent
if (!writePending.tryAcquire()) {
writeInterest = true;
return false;
}
-
+ // If the buffer is empty, it is possible to write to it
if (socketBufferHandler.isWriteBufferEmpty() &&
nonBlockingWriteBuffer.isEmpty()) {
writePending.release();
return true;
}
-
+ // Try to flush all data
boolean isReady = !flushNonBlockingInternal(true);
if (!isReady) {
writeInterest = true;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]