We do it by a dependent scope bean impl callable at the moment... and resolve all req scope variables needed before calling the async method....
But concurrency spec allows only applicationsscope but async also requestscope right? So my idea was that the factory that produces the req scoped beans could get the data from somewhere else and not only from the httpservletreq... but i see your point to stay away from req scopes if we would like to move to java ee concurrency later.... Could you elaborate on request scoped wrapper? I also did some tests with custom scopes a while ago (mostly to learn) but again such a solution would not be very transparent.... Regards LF On Nov 28, 2014 7:45 AM, "Romain Manni-Bucau" <[email protected]> wrote: > Hehe you think like me when I started to impl concurrency utilities for > ee...but spec forbids more or less it and it would break a lot. If that's > just values idea is to use a dependent bean passed as message to the async > method. To keep request scope you need a request scoped wrapper. > Le 28 nov. 2014 02:18, "Lars-Fredrik Smedberg" <[email protected]> a > écrit : > > > Romain, could you please explain what the usage of ThreadContext is? > > > > Today we have some @RequestScoped beans that are created from the > > HttpServletRequest (amongst other things). When executing the > @Asynchronous > > EJB method I would like to be able to inject the same beans again > > (containing the same values). If I understood it correctly the request > > scope is available but when injecting and calling the @RequestScoped > beans > > from the @Asynchronous method they will be created again since we are > > executing on a new thread (and in this case I have no HttpServletRequest > to > > use when creating them)... > > > > For our use cases it is fine if the @RequestScoped beans lives a little > bit > > longer than the original request. > > > > Is there any easy/good way to pass information so I can recreate the > beans > > on the new thread? > > > > Regards > > LF > > > > On Fri, Nov 28, 2014 at 12:33 AM, Lars-Fredrik Smedberg < > > [email protected]> > > wrote: > > > > > Thanks Romain... will take a look at those... > > > > > > Regards > > > LF > > > > > > On Fri, Nov 28, 2014 at 12:21 AM, Romain Manni-Bucau < > > > [email protected]> wrote: > > > > > >> > > >> > > > tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java > > >> > > >> > > >> > > > tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java > > >> Le 28 nov. 2014 00:18, "Lars-Fredrik Smedberg" <[email protected]> a > > >> écrit > > >> : > > >> > > >> > Thanks... What source code can I look at? > > >> > > > >> > Regards > > >> > LF > > >> > > > >> > On Thu, Nov 27, 2014 at 11:29 PM, Romain Manni-Bucau < > > >> > [email protected]> > > >> > wrote: > > >> > > > >> > > It basically just does executorService.execute(new > > >> OpenEjbMethod(method, > > >> > > securitycontext)) > > >> > > Le 27 nov. 2014 22:12, "Lars-Fredrik Smedberg" < > [email protected]> > > a > > >> > > écrit > > >> > > : > > >> > > > > >> > > > Hi! > > >> > > > > > >> > > > I would like to understand how TomEE/OpenEJB implements > > >> @Asynchronous > > >> > EJB > > >> > > > Methods.... > > >> > > > > > >> > > > Can anyone perhaps give me a short descriptions and the point to > > >> what > > >> > > > source code classes to look at? > > >> > > > > > >> > > > Regards > > >> > > > LF > > >> > > > > > >> > > > -- > > >> > > > Med vänlig hälsning / Best regards > > >> > > > > > >> > > > Lars-Fredrik Smedberg > > >> > > > > > >> > > > STATEMENT OF CONFIDENTIALITY: > > >> > > > The information contained in this electronic message and any > > >> > > > attachments to this message are intended for the exclusive use > of > > >> the > > >> > > > address(es) and may contain confidential or privileged > > information. > > >> If > > >> > > > you are not the intended recipient, please notify Lars-Fredrik > > >> Smedberg > > >> > > > immediately at [email protected], and destroy all copies of > this > > >> > > > message and any attachments. > > >> > > > > > >> > > > > >> > > > >> > > > >> > > > >> > -- > > >> > Med vänlig hälsning / Best regards > > >> > > > >> > Lars-Fredrik Smedberg > > >> > > > >> > STATEMENT OF CONFIDENTIALITY: > > >> > The information contained in this electronic message and any > > >> > attachments to this message are intended for the exclusive use of > the > > >> > address(es) and may contain confidential or privileged information. > If > > >> > you are not the intended recipient, please notify Lars-Fredrik > > Smedberg > > >> > immediately at [email protected], and destroy all copies of this > > >> > message and any attachments. > > >> > > > >> > > > > > > > > > > > > -- > > > Med vänlig hälsning / Best regards > > > > > > Lars-Fredrik Smedberg > > > > > > STATEMENT OF CONFIDENTIALITY: > > > The information contained in this electronic message and any > > > attachments to this message are intended for the exclusive use of the > > > address(es) and may contain confidential or privileged information. If > > > you are not the intended recipient, please notify Lars-Fredrik Smedberg > > > immediately at [email protected], and destroy all copies of this > > > message and any attachments. > > > > > > > > > > > -- > > Med vänlig hälsning / Best regards > > > > Lars-Fredrik Smedberg > > > > STATEMENT OF CONFIDENTIALITY: > > The information contained in this electronic message and any > > attachments to this message are intended for the exclusive use of the > > address(es) and may contain confidential or privileged information. If > > you are not the intended recipient, please notify Lars-Fredrik Smedberg > > immediately at [email protected], and destroy all copies of this > > message and any attachments. > > >
