[cdi-dev] Enhancing SPI to support async operation for contexts
rmannibucau at gmail.com
Thu Feb 19 05:22:14 EST 2015
I'm +1 for it but it needs important changes (= surely new contexts).
Typically we can't change today @RequestScoped (which has no link with
a request but only with a thread!).
So we could have @RequestScoped (~ @ThreadLocalScoped) and
@InheritedRequestScoped which would be a real request scope (but not
an InheritedThreadLocal please)
For the request it makes a lot of sense since you need to stay thread
safe even accross threads (servlet spec) and avoids to be forced to
use message passing which - even if a good pattern - adds boilerplate
code for simple async needs.
For JAXRS I dont know since it is really suspend/resume semantic so
request scope maybe doesnt makes much sense here (there is a break in
2015-02-19 10:32 GMT+01:00 Antoine Sabot-Durand <antoine at sabot-durand.net>:
> Hi All,
> Beyond the asynchronous event case, shouldn’t we provide a way for user to launch async treatments in CDI with the possibility to keep the existing contexts at the moment of async operation launch?
> Today servlet or JAX-RS spec support async call without the loss of request for instance. Shouldn’t we think to something like that?
> Thanks for your input on that point.
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
More information about the cdi-dev