Gavin,
This is very ambiguous, as the 1.1 version of the Interceptors
specification states very clearly the signature rules for defining
lifecycle interceptor methods on interceptor classes and target classes.
Also, this could mean that an interceptor class can specify two
different @PostConstruct or @PreDestroy methods, which would refer to
different targets (the intercepted instance/the interceptor itself), but
the specification says very clearly:
"At most one method of a given interceptor class can be designated as an
around-invoke method, an around-timeout method, a post-construct method,
or pre-destroy method."
Also, it is not very clear to me what would be the benefit of a separate
@PostConstruct/@PreDestroy method for the interceptor itself, as
interceptor lifecycles are virtually the same as for the target objects.
Marius
Gavin King wrote:
Check section 5.2.5 of the EE spec. It appears to confirm my
understanding of this stuff.
On Mon, Nov 30, 2009 at 2:33 PM, Gavin King <gavin.king(a)gmail.com> wrote:
> At least, that's my understanding of how interceptors are treated in
> EE6. You would have to check with Roberto and Ken for an absolutely
> definitive answer.
>
> On Mon, Nov 30, 2009 at 2:32 PM, Gavin King <gavin.king(a)gmail.com> wrote:
>
>> Right, but the interceptor itself has a lifecycle. It's a kind of
>> managed bean. So it can have the callbacks that all managed beans can
>> have.
>>
>> On Mon, Nov 30, 2009 at 2:17 PM, Gurkan Erdogdu <gurkanerdogdu(a)yahoo.com>
wrote:
>>
>>> There are two differents scenario for lifecycle callbacks in interceptors
>>> specification
>>>
>>> 1* Used in interceptor class with InvocationContext parameter
>>> @PreDestroy
>>> public void blabla(InvocationContext){}
>>> 2* Used in bean class without any parameter
>>> @PreDestroy
>>> public void blabla(){}
>>>
>>> In TCK, @PreDestroy is used in interceptor class. So it may take
>>> InvocationContext.
>>>
>>> --Gurkan
>>>
>>> ________________________________
>>> From: Gavin King <gavin.king(a)gmail.com>
>>> To: Gurkan Erdogdu <gurkanerdogdu(a)yahoo.com>
>>> Cc: weld-dev(a)lists.jboss.org
>>> Sent: Mon, November 30, 2009 9:10:17 PM
>>> Subject: Re: [weld-dev] TCK Interceptors Classes
>>>
>>> Hrm, I think there are two kinds of @PreDestroy methods for an interceptor:
>>>
>>> @PreDestroy void foo(InvocationContext) { .. } -> the intercepted
>>> bean is being destroyed
>>> @PreDestroy void foo() { .. } -> the interceptor itself is being
destroyed
>>>
>>> Right?
>>>
>>> On Mon, Nov 30, 2009 at 1:34 PM, Gurkan Erdogdu
<gurkanerdogdu(a)yahoo.com>
>>> wrote:
>>>
>>>> Hi;
>>>>
>>>> Some interceptors classes in the TCK test suites implement @PreDestroy
>>>> methods. AFAIK, interceptors specification says that methods with
>>>> @PreDestroy in interceptor class must take InvocationContext parameter.
>>>> But
>>>> in TCK, those methods do not take InvocationContext parameter
>>>>
>>>> For example:
>>>>
>>>> org.jboss.jsr299.tck.tests.context.dependent.TransactionalInterceptor
>>>>
>>>> @PreDestroy public void destroy()
>>>> {
>>>> destroyed = true;
>>>> }
>>>>
>>>> Is it correct?
>>>>
>>>> --Gurkan
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> weld-dev mailing list
>>>> weld-dev(a)lists.jboss.org
>>>>
https://lists.jboss.org/mailman/listinfo/weld-dev
>>>>
>>>>
>>>
>>> --
>>> Gavin King
>>> gavin.king(a)gmail.com
>>>
http://in.relation.to/Bloggers/Gavin
>>>
http://hibernate.org
>>>
http://seamframework.org
>>>
>>>
>>>
>>
>> --
>> Gavin King
>> gavin.king(a)gmail.com
>>
http://in.relation.to/Bloggers/Gavin
>>
http://hibernate.org
>>
http://seamframework.org
>>
>>
>
> --
> Gavin King
> gavin.king(a)gmail.com
>
http://in.relation.to/Bloggers/Gavin
>
http://hibernate.org
>
http://seamframework.org
>
>