Author: remm
Date: Fri May 30 07:48:34 2014
New Revision: 1598480
URL: http://svn.apache.org/r1598480
Log:
Remove listener calls optimizations, they skip a lot of things which could be
useful and ultimately it doesn't work that well.
Modified:
tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java
tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java
Modified:
tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java?rev=1598480&r1=1598479&r2=1598480&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java
(original)
+++
tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletInputStream.java
Fri May 30 07:48:34 2014
@@ -40,7 +40,7 @@ public class Nio2ServletInputStream exte
private final CompletionHandler<Integer, SocketWrapper<Nio2Channel>>
completionHandler;
private boolean flipped = false;
private volatile boolean readPending = false;
- private volatile boolean fireListener = false;
+ private volatile boolean interest = false;
public Nio2ServletInputStream(SocketWrapper<Nio2Channel> wrapper,
AbstractEndpoint<Nio2Channel> endpoint0) {
this.endpoint = endpoint0;
@@ -49,31 +49,21 @@ public class Nio2ServletInputStream exte
this.completionHandler = new CompletionHandler<Integer,
SocketWrapper<Nio2Channel>>() {
@Override
public void completed(Integer nBytes, SocketWrapper<Nio2Channel>
attachment) {
- boolean fire = false;
+ boolean notify = false;
synchronized (completionHandler) {
if (nBytes.intValue() < 0) {
failed(new EOFException(), attachment);
- return;
- }
- readPending = false;
- fire = fireListener;
- fireListener = false;
- }
- if (nBytes.intValue() > 0) {
- if (!Nio2Endpoint.isInline() && fire) {
- try {
- onDataAvailable();
- } catch (IOException e) {
- failed(e, attachment);
+ } else {
+ readPending = false;
+ if (interest && !Nio2Endpoint.isInline()) {
+ interest = false;
+ notify = true;
}
}
- } else {
- try {
- onAllDataRead();
- } catch (IOException e) {
- failed(e, attachment);
- }
}
+ if (notify) {
+ endpoint.processSocket(attachment, SocketStatus.OPEN_READ,
false);
+ }
}
@Override
public void failed(Throwable exc, SocketWrapper<Nio2Channel>
attachment) {
@@ -93,7 +83,7 @@ public class Nio2ServletInputStream exte
protected boolean doIsReady() throws IOException {
synchronized (completionHandler) {
if (readPending) {
- fireListener = true;
+ interest = true;
return false;
}
ByteBuffer readBuffer = channel.getBufHandler().getReadBuffer();
@@ -116,7 +106,7 @@ public class Nio2ServletInputStream exte
flipped = true;
}
} else {
- fireListener = true;
+ interest = true;
}
return isReady;
}
Modified:
tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java?rev=1598480&r1=1598479&r2=1598480&view=diff
==============================================================================
---
tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java
(original)
+++
tomcat/trunk/java/org/apache/coyote/http11/upgrade/Nio2ServletOutputStream.java
Fri May 30 07:48:34 2014
@@ -58,13 +58,7 @@ public class Nio2ServletOutputStream ext
} else {
writePending.release();
if (!Nio2Endpoint.isInline()) {
- try {
- onWritePossible();
- } catch (IOException e) {
- socketWrapper.setError(true);
- onError(e);
- endpoint.processSocket(socketWrapper,
SocketStatus.ERROR, false);
- }
+ endpoint.processSocket(socketWrapper,
SocketStatus.OPEN_WRITE, false);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]