Author: remy.maucherat(a)jboss.com
Date: 2012-11-16 06:50:32 -0500 (Fri, 16 Nov 2012)
New Revision: 2125
Modified:
branches/7.2.x/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java
branches/7.2.x/src/main/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
branches/7.2.x/webapps/docs/changelog.xml
Log:
- Fix setting timeout with the NIO2 connector (doh).
- Set last write when using non blocking writes (otherwise they will never stop coming,
creating a loop).
The behavior (= amount of data written) looks rather similar to the APR connector now.
Modified: branches/7.2.x/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java 2012-11-14
15:18:42 UTC (rev 2124)
+++
branches/7.2.x/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java 2012-11-16
11:50:32 UTC (rev 2125)
@@ -853,7 +853,7 @@
} else if (actionCode == ActionCode.ACTION_EVENT_WRITE) {
// Write event
writeEvent(param);
- } else if (actionCode == ActionCode.ACTION_EVENT_WRITE) {
+ } else if (actionCode == ActionCode.ACTION_EVENT_TIMEOUT) {
// Timeout event
timeoutEvent(param);
} else if (actionCode == ActionCode.UPGRADE) {
Modified:
branches/7.2.x/src/main/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
===================================================================
---
branches/7.2.x/src/main/java/org/apache/coyote/http11/InternalNioOutputBuffer.java 2012-11-14
15:18:42 UTC (rev 2124)
+++
branches/7.2.x/src/main/java/org/apache/coyote/http11/InternalNioOutputBuffer.java 2012-11-16
11:50:32 UTC (rev 2125)
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.CompletionHandler;
+import java.nio.channels.WritePendingException;
import java.util.concurrent.TimeUnit;
import org.apache.coyote.ActionCode;
@@ -87,10 +88,16 @@
if (nBytes < 0) {
failed(new ClosedChannelException(), attachment);
return;
+ } else {
+ response.setLastWrite(nBytes);
}
if (bbuf.hasRemaining()) {
- attachment.write(bbuf, writeTimeout, TimeUnit.MILLISECONDS, attachment, this);
+ try {
+ attachment.write(bbuf, writeTimeout, TimeUnit.MILLISECONDS, attachment,
this);
+ } catch (WritePendingException e) {
+ response.setLastWrite(0);
+ }
} else {
// Clear the buffer when all bytes are written
clearBuffer();
Modified: branches/7.2.x/webapps/docs/changelog.xml
===================================================================
--- branches/7.2.x/webapps/docs/changelog.xml 2012-11-14 15:18:42 UTC (rev 2124)
+++ branches/7.2.x/webapps/docs/changelog.xml 2012-11-16 11:50:32 UTC (rev 2125)
@@ -33,6 +33,9 @@
<fix>
<jira>250</jira>: Fix remote address, submitted by Cheng Fang.
(remm)
</fix>
+ <fix>
+ Fix various issues in the NIO2 connector related to async and event. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Jasper">