You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by Eric Covener <co...@gmail.com> on 2010/01/07 15:04:12 UTC

Re: [jira] Created: (OWB-182) Even if @PreDestroy is used in an Interceptor, it doesn't need an InvoicationContext parameter

On Mon, Nov 30, 2009 at 4:14 PM, Mark Struberg <st...@yahoo.de> wrote:
> I think the current discussion between Gavin and Marius shows that this question is not that easy to answer :)
>
> In fact I thought about this since yesterday and also came to the conclusion that there are 2 completely different lifecycles ment with @PreDestroy and @PreDestroy(InvocationContext) on an Interceptor class. The first will get called before the interceptor instance itself will be freed, the 2nd will get called for each and every destruction of an intercepted bean.
>
> The problem I also see is that the EE spec currently forbids having 2 methods being annotated with PreDestroy and @PostConstruct.
>
> It should be ok to allow exactly 1 of each kind for an @Interceptor, but that is not covered by the EE spec.
>
> But anyhow, over all the thinking about that stuff, I forgot to fix the unit test in webbeans-impl *shameonme*.

Resurrecting an old thread.

WebBeansUtil.checkCommonAnnotationCriterias()  expects @PostConstruct
in an Interceptor class to have a void return type, but shouldn't it
look exactly like the @AroundInvoke in such a case (return Object for
ic.proceed(), throw Exception, etc)?

e.g. http://people.apache.org/~covener/patches/owb-lifcycle_interceptors.diff ?


-- 
Eric Covener
covener@gmail.com

Re: [jira] Created: (OWB-182) Even if @PreDestroy is used in an Interceptor, it doesn't need an InvoicationContext parameter

Posted by Eric Covener <co...@gmail.com>.
On Thu, Jan 7, 2010 at 9:29 AM, Eric Covener <co...@gmail.com> wrote:
> On Thu, Jan 7, 2010 at 9:15 AM, Gurkan Erdogdu <cg...@gmail.com> wrote:
>> No. EJB Interceptor specification defines Lifecycle callback methods as
>> follows
>>
>> If in Interceptor class
>>  void <METHOD> (InvocationContext)
>>
>> If in bean class
>> void <METHOD>()
>
> Thanks -- is the convention that the lifecycle callbakcs in the
> Interceptor class  just call ic.proceed() (but not returning the
> value) on their way out, or are these not typically chained the way
> @AroundInvoke are?
>

Finally found my way to EJB3 spec and it does seem that convention is

{
...
ic.proceed;
...
}

for lifecyele callback inside an Interceptor



-- 
Eric Covener
covener@gmail.com

Re: [jira] Created: (OWB-182) Even if @PreDestroy is used in an Interceptor, it doesn't need an InvoicationContext parameter

Posted by Eric Covener <co...@gmail.com>.
On Thu, Jan 7, 2010 at 9:15 AM, Gurkan Erdogdu <cg...@gmail.com> wrote:
> No. EJB Interceptor specification defines Lifecycle callback methods as
> follows
>
> If in Interceptor class
>  void <METHOD> (InvocationContext)
>
> If in bean class
> void <METHOD>()

Thanks -- is the convention that the lifecycle callbakcs in the
Interceptor class  just call ic.proceed() (but not returning the
value) on their way out, or are these not typically chained the way
@AroundInvoke are?

-- 
Eric Covener
covener@gmail.com

Re: [jira] Created: (OWB-182) Even if @PreDestroy is used in an Interceptor, it doesn't need an InvoicationContext parameter

Posted by Gurkan Erdogdu <cg...@gmail.com>.
No. EJB Interceptor specification defines Lifecycle callback methods as
follows

If in Interceptor class
 void <METHOD> (InvocationContext)

If in bean class
void <METHOD>()

Thks;

--Gurkan

2010/1/7 Eric Covener <co...@gmail.com>

> On Mon, Nov 30, 2009 at 4:14 PM, Mark Struberg <st...@yahoo.de> wrote:
> > I think the current discussion between Gavin and Marius shows that this
> question is not that easy to answer :)
> >
> > In fact I thought about this since yesterday and also came to the
> conclusion that there are 2 completely different lifecycles ment with
> @PreDestroy and @PreDestroy(InvocationContext) on an Interceptor class. The
> first will get called before the interceptor instance itself will be freed,
> the 2nd will get called for each and every destruction of an intercepted
> bean.
> >
> > The problem I also see is that the EE spec currently forbids having 2
> methods being annotated with PreDestroy and @PostConstruct.
> >
> > It should be ok to allow exactly 1 of each kind for an @Interceptor, but
> that is not covered by the EE spec.
> >
> > But anyhow, over all the thinking about that stuff, I forgot to fix the
> unit test in webbeans-impl *shameonme*.
>
> Resurrecting an old thread.
>
> WebBeansUtil.checkCommonAnnotationCriterias()  expects @PostConstruct
> in an Interceptor class to have a void return type, but shouldn't it
> look exactly like the @AroundInvoke in such a case (return Object for
> ic.proceed(), throw Exception, etc)?
>
> e.g.
> http://people.apache.org/~covener/patches/owb-lifcycle_interceptors.diff<http://people.apache.org/%7Ecovener/patches/owb-lifcycle_interceptors.diff>?
>
>
> --
> Eric Covener
> covener@gmail.com
>



-- 
Gurkan Erdogdu
http://gurkanerdogdu.blogspot.com