[undertow-dev] HttpServerExchange.unDispatch()

Stuart Douglas sdouglas at redhat.com
Wed Sep 16 01:01:20 EDT 2015



----- Original Message -----
> From: "Chris Back" <chris.back at gmail.com>
> To: undertow-dev at lists.jboss.org
> Sent: Wednesday, 16 September, 2015 12:44:32 PM
> Subject: [undertow-dev] HttpServerExchange.unDispatch()
> 
> I noticed an undocumented (as far as I can tell) public method on the
> exchange, unDispatch(). How is this supposed to be used? Is it to move a
> process back into the IO thread pool?
> 
> I ask because I have written a ChannelListener that reads in the entire http
> entity before passing the request through to the next HttpHandler. I have
> noticed sometimes without my dispatching the request the exchange gets
> dispatched on it own. I assume this is some side effect calling
> channel.resumeReads().

unDispatch basically just clears the 'dispatch' flag, cancelling an earlier dispatch. Basically the only real use for this is for servlet, if a user calls startAsync() then AC.complete() immediately we call unDispatch() to cancel the dispatch(). 

Also you are correct that calling resumeReads() results in a dispatch, basically this allows us to wait until the call stack has returned before actually resuming reads (otherwise both the current thread and the IO thread could be modifying the exchange at the same time).

Stuart

> 
> Is it safe to use exchange.unDispatch() like dispatch() (only in reverse)?
> 
> -Chris
> 
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev


More information about the undertow-dev mailing list