Author: markt
Date: Tue Sep 29 21:18:16 2015
New Revision: 1705926
URL: http://svn.apache.org/viewvc?rev=1705926&view=rev
Log:
Simplify. ISE should be impossible. There is only one container thread at a
time. To get this far thread must be in STARTED stated which means no ISE will
be thrown.
Modified:
tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java
Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=1705926&r1=1705925&r2=1705926&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Tue Sep 29
21:18:16 2015
@@ -621,35 +621,27 @@ public class AjpProcessor extends Abstra
public SocketState dispatch(SocketStatus status) {
if (status == SocketStatus.OPEN_WRITE && response.getWriteListener()
!= null) {
+ asyncStateMachine.asyncOperation();
try {
- asyncStateMachine.asyncOperation();
- try {
+ if (hasDataToWrite()) {
+ socketWrapper.flush(false);
if (hasDataToWrite()) {
- socketWrapper.flush(false);
- if (hasDataToWrite()) {
- // There is data to write but go via Response to
- // maintain a consistent view of non-blocking state
- response.checkRegisterForWrite();
- return SocketState.LONG;
- }
- }
- } catch (IOException x) {
- if (getLog().isDebugEnabled()) {
- getLog().debug("Unable to write async data.",x);
+ // There is data to write but go via Response to
+ // maintain a consistent view of non-blocking state
+ response.checkRegisterForWrite();
+ return SocketState.LONG;
}
- status = SocketStatus.ASYNC_WRITE_ERROR;
- request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, x);
}
- } catch (IllegalStateException x) {
- socketWrapper.registerWriteInterest();
+ } catch (IOException ioe) {
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("Unable to write async data.", ioe);
+ }
+ status = SocketStatus.ASYNC_WRITE_ERROR;
+ request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, ioe);
}
} else if (status == SocketStatus.OPEN_READ &&
request.getReadListener() != null) {
- try {
- if (available()) {
- asyncStateMachine.asyncOperation();
- }
- } catch (IllegalStateException x) {
- socketWrapper.registerReadInterest();
+ if (available()) {
+ asyncStateMachine.asyncOperation();
}
}
Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=1705926&r1=1705925&r2=1705926&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java Tue Sep 29
21:18:16 2015
@@ -1714,26 +1714,15 @@ public class Http11Processor extends Abs
return SocketState.LONG;
}
}
- } catch (IOException | IllegalStateException x) {
- // IOE - Problem writing to socket
- // ISE - Request/Response not in correct state for async write
+ } catch (IOException ioe) {
if (log.isDebugEnabled()) {
- log.debug("Unable to write async data.",x);
+ log.debug("Unable to write async data.", ioe);
}
status = SocketStatus.ASYNC_WRITE_ERROR;
- request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, x);
+ request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, ioe);
}
} else if (status == SocketStatus.OPEN_READ &&
request.getReadListener() != null) {
- try {
- asyncStateMachine.asyncOperation();
- } catch (IllegalStateException x) {
- // ISE - Request/Response not in correct state for async read
- if (log.isDebugEnabled()) {
- log.debug("Unable to read async data.",x);
- }
- status = SocketStatus.ASYNC_READ_ERROR;
- request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, x);
- }
+ asyncStateMachine.asyncOperation();
}
RequestInfo rp = request.getRequestProcessor();
Modified: tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java?rev=1705926&r1=1705925&r2=1705926&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http2/StreamProcessor.java Tue Sep 29
21:18:16 2015
@@ -424,26 +424,15 @@ public class StreamProcessor extends Abs
}
return SocketState.LONG;
}
- } catch (IOException | IllegalStateException x) {
- // IOE - Problem writing to socket
- // ISE - Request/Response not in correct state for async write
+ } catch (IOException ioe) {
if (log.isDebugEnabled()) {
- log.debug("Unable to write async data.",x);
+ log.debug("Unable to write async data.", ioe);
}
status = SocketStatus.ASYNC_WRITE_ERROR;
- request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, x);
+ request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, ioe);
}
} else if (status == SocketStatus.OPEN_READ &&
request.getReadListener() != null) {
- try {
- asyncStateMachine.asyncOperation();
- } catch (IllegalStateException x) {
- // ISE - Request/Response not in correct state for async read
- if (log.isDebugEnabled()) {
- log.debug("Unable to read async data.",x);
- }
- status = SocketStatus.ASYNC_READ_ERROR;
- request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, x);
- }
+ asyncStateMachine.asyncOperation();
}
RequestInfo rp = request.getRequestProcessor();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]