[undertow-dev] Is it ok to do a blocking action from a Receiver callback?

Michael Grove mike at stardog.com
Fri Mar 31 08:10:58 EDT 2017


So what would be the right workflow using Receiver to read a large request,
do something time-consuming, and send back a response? Use Receiver
callbacks to write partial payloads to disk, and the last callback then
dispatch to a worker thread?

Cheers,

Mike

On Fri, Mar 31, 2017 at 6:30 AM, Stuart Douglas <sdouglas at redhat.com> wrote:

> It will generally be handled by an IO thread, although it can depend
> on how large the request is. If a request is small enough that it gets
> read immediately then the request will be handled in the same thread,
> otherwise it will be handled by the IO thread to full read the
> request.
>
> Stuart
>
> On Fri, Mar 31, 2017 at 8:05 PM, Antoine Girard
> <antoine.girard at ymail.com> wrote:
> > Correct me if I am wrong Stuart but if the request was already dispatched
> > before calling the getRequestReceiver(), then the callback will be
> handled
> > by a worker thread.
> >
> > Cheers,
> > Antoine
> >
> > On Thu, Mar 30, 2017 at 11:48 PM, Stuart Douglas <sdouglas at redhat.com>
> > wrote:
> >>
> >> No, the callback is invoked by the IO thread, so you would need to
> >> dispatch to a worker thread.
> >>
> >> Stuart
> >>
> >> On Fri, Mar 31, 2017 at 6:58 AM, Michael Grove <mike at stardog.com>
> wrote:
> >> > If I have some code ala
> >> >
> >> > theRequest.getRequestReceiver().receiveFullString((theExchange, str)
> ->
> >> > {
> >> >   ...
> >> > });
> >> >
> >> > Is it ok to perform a time consuming task w/ the body of the request
> in
> >> > the
> >> > callback, or is it better to move off the io thread and use
> >> > `HttpServerExchange.getInputStream`?
> >> >
> >> > Cheers,
> >> >
> >> > Mike
> >> >
> >> > _______________________________________________
> >> > undertow-dev mailing list
> >> > undertow-dev at lists.jboss.org
> >> > https://lists.jboss.org/mailman/listinfo/undertow-dev
> >> _______________________________________________
> >> undertow-dev mailing list
> >> undertow-dev at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/undertow-dev
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170331/091917dc/attachment.html 


More information about the undertow-dev mailing list