2014-11-28 9:26 GMT+01:00 Lars-Fredrik Smedberg <[email protected]>: > Oh, so by request scoped wrapped you mean simply pull out whatever data I > need from the scoped beans before I call the async method? >
sure "message passing" pettern > About async ejb methods and CDI I read JSR299 (which we depend on) and in > 6.7.1 and 6.7.3 I think it says request and application context are valid > for any asyn ejb method call... and in JSR236 in section 2.3.2.1 that > application context is valid for tasks but I might have enterpreted it > wrong? > it is correct but no inheritance between thread so @Async doesn't use the *same* request scoped instance > You say that you will have the same implementation for async and java ee > concurrency... does this mean that for java ee concurrency you will also > allow request context (even though its outside spec to use)? > it is the case for 2.0-SNAPSHOT. It means it will work as today > Regards > LF > > > On Fri, Nov 28, 2014 at 9:05 AM, Romain Manni-Bucau <[email protected]> > wrote: > >> Le 28 nov. 2014 08:49, "Lars-Fredrik Smedberg" <[email protected]> a >> écrit >> : >> > >> > 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? >> >> Not explicitely - tend to be the opposite btw - and on tomee 2 both use the >> same impl for consistency. >> >> > 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? >> > >> >> You use a req bean the do reqbean.getData() and pass it to the async task. >> >> > 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. >> > > > >> > > >> > > > > -- > 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.
