Author: remm
Date: Wed Feb 20 11:50:55 2019
New Revision: 1853951
URL: http://svn.apache.org/viewvc?rev=1853951&view=rev
Log:
Fix test
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1853951&r1=1853950&r2=1853951&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Wed Feb 20
11:50:55 2019
@@ -598,6 +598,11 @@ public class Nio2Endpoint extends Abstra
if (nBytes.intValue() < 0) {
failed(new EOFException(), attachment);
} else {
+ /*if (Nio2Endpoint.isInline()) {
+ System.out.println("Inline " + readInterest +
" " + nBytes.intValue());
+ } else {
+ System.out.println("Not inline " +
readInterest + " " + nBytes.intValue() + " " +
Thread.currentThread().getName());
+ }*/
if (readInterest && !Nio2Endpoint.isInline()) {
readInterest = false;
notify = true;
@@ -823,6 +828,16 @@ public class Nio2Endpoint extends Abstra
@Override
public int read(boolean block, ByteBuffer to) throws IOException {
+ if (!ContainerThreadMarker.isContainerThread()) {
+ synchronized (this) {
+ return readInternal(block, to);
+ }
+ } else {
+ return readInternal(block, to);
+ }
+ }
+
+ protected int readInternal(boolean block, ByteBuffer to) throws
IOException {
checkError();
if (socketBufferHandler == null) {
@@ -877,12 +892,10 @@ public class Nio2Endpoint extends Abstra
readInterest = true;
}
}
-
return nRead;
}
}
-
@Override
public void close() {
if (log.isDebugEnabled()) {
Modified:
tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java?rev=1853951&r1=1853950&r2=1853951&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java
(original)
+++ tomcat/trunk/test/org/apache/catalina/nonblocking/TestNonBlockingAPI.java
Wed Feb 20 11:50:55 2019
@@ -122,7 +122,11 @@ public class TestNonBlockingAPI extends
"http://localhost:" + getPort() + "/", new ByteChunk(),
resHeaders, null);
Assert.assertEquals(HttpServletResponse.SC_OK, rc);
- Assert.assertEquals(2000000 * 8, servlet.listener.body.length());
+ if (async) {
+ Assert.assertEquals(2000000 * 8, servlet.listener.body.length());
+ } else {
+ Assert.assertEquals(5 * 8, servlet.listener.body.length());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]