Good to know...

So in the case no CDI-proxy is created the EJB-proxy will also run the
CDI-interceptors?

I read that any EJB-interceptors will run after any tx has started (the EJB
or EJB-method is annotated with @TransactionAttribute).

In the case of an CDI-proxy I assume that any CDI-interceptors will run
before the tx is started, is that the case?

In the case of the CDI-interceptors being run by the EJB-proxy will they
then also run beefore the tx is started?

Hope you can clarify the above, would help me alot.

Thanks
Lars-Fredrik




On Wed, Aug 27, 2014 at 6:56 AM, Romain Manni-Bucau <[email protected]>
wrote:

> It works but it is handled by the ejb itself, not cdi
> Le 26 août 2014 21:53, "Lars-Fredrik Smedberg" <[email protected]> a
> écrit :
>
> > @Romain
> >
> > I though that I could @Inject an EJB and apply CDI-interceptors to the
> EJB
> > or methods on it.
> >
> > Reading your answer it seems like I only can do that if the injceted EJB
> is
> > a scoped stateful EJB because in other cases no CDI-proxy is created....
> >
> > Did I get that right or did I misunderstand you?
> >
> > Thanks
> > Lars-Fredrik
> >
> >
> > On Tue, Aug 26, 2014 at 10:46 PM, Romain Manni-Bucau <
> > [email protected]>
> > wrote:
> >
> > > no only for scoped stateful. for singleton/stateless you get the ejb
> > > proxy directly
> > >
> > >
> > > Romain Manni-Bucau
> > > Twitter: @rmannibucau
> > > Blog: http://rmannibucau.wordpress.com/
> > > LinkedIn: http://fr.linkedin.com/in/rmannibucau
> > > Github: https://github.com/rmannibucau
> > >
> > >
> > > 2014-08-26 21:10 GMT+02:00 Lars-Fredrik Smedberg <[email protected]>:
> > > > Sorry for that, ofcourse I meant @Stateful, that was what we
> discussed
> > in
> > > > the previous posts :)
> > > >
> > > > Thinking of the CDI proxy in front of the EJB proxy makes it easier
> to
> > > > understand what is going on under the hood.
> > > >
> > > > A follow up question:
> > > >
> > > > - Will a CDI proxy always be created in front of the EJB proxy if the
> > EJB
> > > > is injected using @Inject? Or is that also the case when using @EJB?
> I
> > > > guess even for dependent scoped CDI beans a proxy is used to be able
> to
> > > > trigger interceptors etc.
> > > >
> > > >
> > > > Regards
> > > > LF
> > > >
> > > >
> > > > On Tue, Aug 26, 2014 at 7:06 PM, Romain Manni-Bucau <
> > > [email protected]>
> > > > wrote:
> > > >
> > > >> replace @Stateless by @Stateful and it is that
> > > >>
> > > >> cdi scope is just a proxy in front of ejb proxy
> > > >>
> > > >>
> > > >> Romain Manni-Bucau
> > > >> Twitter: @rmannibucau
> > > >> Blog: http://rmannibucau.wordpress.com/
> > > >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> > > >> Github: https://github.com/rmannibucau
> > > >>
> > > >>
> > > >> 2014-08-26 17:54 GMT+02:00 Lars-Fredrik Smedberg <
> [email protected]
> > >:
> > > >> > 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.
> > > >> >>
> > > >>
> > > >
> > > >
> > > >
> > > > --
> > > > 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.

Reply via email to