If using the response results in an exception during async processing (e.g.
client dropped the connection) what, if any, error processing (e.g. notify
registered AsyncListener's) is expected on:
(a) container threads - after startAsync but before the container thread is
returned
(b) non-container threads - before a dispatch
What options does the application have to complete async processing? Can
asyncContext.complete() be called or is it it necessary to dispatch?
These questions came up while trying to call complete() in Tomcat following
a client disconnect [1] and subsequently discussing it on the Tomcat
mailing list. Consider what happens in Tomcat where the IOException simply
sets a flag that an error occurred. The application catches the exception
and calls asyncContext.complete() and as the container is given control it
notices the error and tries to handle it. However, the request is already
in "completing" state leading to the IllegalStateException.
Thanks,
Rossen
[1]
https://issues.apache.org/bugzilla/show_bug.cgi?id=54928