arjan.tijms at gmail.com
Sun Mar 20 17:21:00 EDT 2016
If you pass an AsyncContext to a random other thread (which is not
necessarily container managed), then the fact that code in this other
thread gets hold of this context, doesn't set up the TLS stuff needed for
@RequestScoped etc, does it?
If so, how would this technically work?
This is different from container managed threads which get work submitted
to it (like Concurrency spec executor service and @Asynchronous). They have
an opportunity to set up and tear down the contexts before and after
working on the unit respectively.
For the AsyncContext case, what about something like the following in the
thread that in whatever way gets hold of the AsyncContext
or with a guard:
Would that work?
On Sun, Mar 20, 2016 at 9:51 PM, Mark Struberg <struberg at yahoo.de> wrote:
> I think the current spec wording already defines what happens in that
> case. At least there are TCK tests for it.
> On Sunday, 20 March 2016, 21:37, arjan tijms <arjan.tijms at gmail.com>
> >On Sun, Mar 20, 2016 at 6:36 PM, Manfred Riem <mnriem at gmail.com> wrote:
> >Why is changing @RequestScoped out of the question?
> >>From my perspective when an AsyncContext is started the request is still
> >>It is just being served by a different thread.
> >With just AsyncContext the original request thread can end and a new
> thread can write to the response. Both of them can access the request
> object after the AsyncContext has been handed to the second thread. But the
> second thread is not necessarily "connected" to anything, is it? It's just
> any random thread that gets the AsyncContext object passed in.
> >Would it work here if there was a public CDI API available to activate
> the request scope (and session scope possibly) from a given instance of
> >Regardless, this is a slightly different problem from when a given
> request thread submits work to a Concurrency spec executor.
> >Kind regards,
> >Arjan Tijms
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cdi-dev