Is it possible to tell from an AsyncContext, whether it has completed, timed out or still waiting to be completed?
I know it’s possible to listen for timeout or complete events, but I’d prefer not to define 4 AsyncListener listener methods just to record this information.
If I am not mistaken Tomcat returns
nullwhenAsyncContext.getRequest()is called on timeoutedAsyncContext.I can not confirm this behaviour now, moreover it is not documented, hence should be considered unsafe and not portable.
BTW Tomcat was doing that because it reuses
HttpServletRequestand response objects once the request is handled, just like it reuses servlet instances or threads. Sounds like insane optimization for me, but the spec does not forbid that…