stateful appscoped = @singleton @lock(write)
Romain Manni-Bucau Twitter: @rmannibucau Blog: http://rmannibucau.wordpress.com/ LinkedIn: http://fr.linkedin.com/in/rmannibucau Github: https://github.com/rmannibucau 2014-09-01 16:27 GMT+02:00 Lars-Fredrik Smedberg <[email protected]>: > Hi Romain > > A follow up question. What will the difference between a @Singleton EJB and > a @Statefull @ApplicationScoped EJB be? Is it only the fact that the latter > will have a CDI-proxy in fron of the EJB-proxy but function wise they will > work the same? > > Regards > Lars-Fredrik > > > On Tue, Aug 26, 2014 at 4:50 PM, Romain Manni-Bucau <[email protected]> > wrote: > >> Hi >> >> 2014-08-26 16:45 GMT+02:00 Lars-Fredrik Smedberg <[email protected]>: >> > Hi >> > >> > I have a few questions on EJB, CDI and Concurrency when I read >> > http://tomee.apache.org/examples-trunk/access-timeout/README.html, I >> read >> > >> > - Concurrent access to a @Stateful bean is serialized by the container. >> > >> > I also understand that I can annotate the EJBs with any of the CDI-scopes >> > (in my case I'm interested in @RequestScoped, @SessionScoped and >> > @ApplicationScoped). >> > >> > Questions: >> > >> > 1. If I annotate the @Stateful bean with @RequestScoped I assume that I >> get >> > a separate bean instance for each call? Correct? >> >> yes >> >> > 2. If I annotate the @Stateful bean with @SessionScoped I assume that I >> per >> > sesion get a separate bean instance that allows concurrent calls withing >> > that particular session without wait? Correct? >> >> you get one instance by session and calls are serialized if needed to >> ensure thread safety >> >> > 3. If I annotate the @Stateful bean with @ApplicationScoped I assume >> that I >> > per application get one bean instance that allows concurrent calls >> without >> > wait? Correct? >> > >> >> same as before, thread safety is ensured >> >> > The reason I ask is that as far as I understand CDI does not have any >> > concurrency management but the EJB has. What will be the case when doing >> as >> > above? >> > >> > Please help me get some in-depth understanding on this. >> > >> >> for @AppScoped => look @javax.ejb.Singleton and @Lock which is surely >> better >> >> > Thanks >> > Lars-Fredrik Smedberg >> > >> > >> > >> > -- >> > 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.
