Thanks for the answer.

So to summarize the scoping rules from CDI apply and the concurrency
management from EJB apply when combining @Stateless and any of the
@NormalScopes...

Regards
Lars-Fredrik
On 26 Aug 2014 16:50, "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.
>

Reply via email to