apache/httpcore — pull request #5 by hirthwork (2014-10-14 16:22:52+00:00)
Title: Allow custom processing for "Response already submitted" errors

Currently, second call of exchage.submitResponse() will raise IllegalStateException. There is no way to log any additional information concerning request caused this error.

Two new protected functions had been added to HttpAsyncService, their default behaviour is exactly same as it was before: throw IllegalStateException with "Response already submitted". Anyone can override them and log any request information stored in context.

Also, HttpAsyncExchangeImpl.completed flag made atomic, so really no two concurrent submissions will be available. Currently two threads could call submitResponse, simultaneously pass completion flag check and after that one of responses will be silently lost without notifying anybody.