Bug 57326 - AsyncContextImpl doesn't allow AsyncListener to re-register themselves when firing onStartAsync
AsyncContextImpl doesn't allow AsyncListener to re-register themselves when f...
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Catalina
trunk
PC All
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2014-12-08 09:16 UTC by Erwan Fouret
Modified: 2014-12-15 16:24 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erwan Fouret 2014-12-08 09:16:59 UTC
According to the official Java EE Javadoc (cf. https://docs.oracle.com/javaee/7/api/javax/servlet/AsyncListener.html#onStartAsync%28javax.servlet.AsyncEvent%29), AsyncListeners should be allowed to re-register themselves when the event "onStartAsync" is started : "This AsyncListener will not receive any events related to the new asynchronous cycle unless it registers itself (via a call to AsyncContext.addListener(javax.servlet.AsyncListener)) with the AsyncContext that is delivered as part of the given AsyncEvent.".
In tomcat 7.0.x, the actual implementation prevents this behavior since the listeners list is cleared *after* firing the event (cf. AdyncContextImpl.java:366). If the list was cleared before firing the event, listeners would be able to re-register themselves if needed.
Comment 1 Mark Thomas 2014-12-15 16:24:48 UTC
Thanks for the report.

This has been fixed in trunk, 8.0.x (for 8.0.16 onwards) and 7.0.x (for 7.0.58 onwards).