users@interceptors-spec.java.net

[interceptors-spec users] Re: [jsr345-experts] Interceptors 1.2 MR candidate is available for the final review

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Fri, 12 Apr 2013 10:36:50 -0700

Antonio,

The spec says (2.8):

"Only the interception methods of the interceptor class that are
relevant for the context in which the interceptor is bound are invoked.
For example, if the interceptor is bound only to a business method, any
AroundConstruct, AroundTimeout, PostConstruct, or PreDestroy methods on
the interceptor are not called."

Your example is correct. But let me know if the above paragraph is not
clear.

thanks,
-marina

On 4/12/13 2:29 AM, Antonio Goncalves wrote:
> Marina, something that is not clear to me. Let's say you have an
> interceptor class that intercept construtor and method invocations,
> something like :
>
> public class LoggingInterceptor {
>
> *_at_AroundConstruct*
> private void logConstructor(InvocationContext ic) throws Exception {...}
>
> *_at_AroundInvoke*
> public Object logMethod(InvocationContext ic) throws Exception {...}
> }
>
>
> If the bean defines the interceptor on the class, all interceptions
> (contructor + method calls) will happen, correct :
>
> *_at_Interceptors(LoggingInterceptor.class)*
> public class CustomerService {
> public void createCustomer(Customer customer) {...}
> public Customer findCustomerById(Long id) {...}
> }
>
> But if the interceptor is defined only on a method, the
> @AroundConstruct will not be invoked. Am I correct here ? By reading
> the spec this sounds a bit vague (or I might have missed something)
>
> public class CustomerService {
> public void createCustomer(Customer customer) {...}
> *_at_Interceptors(LoggingInterceptor.class)*
> public Customer findCustomerById(Long id) {...}
> }
>
>
> Thanks
> Antonio
>
>
> On Fri, Apr 12, 2013 at 3:20 AM, Marina Vatkina
> <marina.vatkina_at_oracle.com <mailto:marina.vatkina_at_oracle.com>> wrote:
>
> For those of you who follow the Interceptors 1.2 MR,
>
> I have uploaded what is hopefully the final MR candidate, to the
> Interceptors java.net <http://java.net> download page: Update of
> 0411 with change bars
> <http://java.net/projects/interceptors-spec/downloads/download/interceptor-1-2-mrel-0411.pdf>.
>
>
> The latest javadoc: javadoc MR candidate
> <http://java.net/projects/interceptors-spec/downloads/download/javax.interceptor-1-2-mr-candidate.zip>
>
>
> As you all read the email titled "Issues with interceptors bound
> to a component lifecycle callback", you know why the Interceptors
> MR did not become final when it was originally planned. The exact
> changes for the removal of support for lifecycle callback method
> interceptors can be found in a diff version: Changes to revert
> support of lifecycle-c allback method-level interceptors
> <http://java.net/projects/interceptors-spec/downloads/download/Chapters-lc-method-level-removed-diff.pdf>.
>
> The current version also include some fixed typos and editorial
> changes to clearly list constructor-level interceptors whenever
> method-level interceptors are discussed (if applicable).
>
> Pete, please forward to the CDI EG.
>
> Any review comments must be submitted by the Monday (04/15) to be
> included.
>
> thanks,
> -marina
>
>
>
>
>
>
> --
> Antonio Goncalves
> Software architect and Java Champion
>
> Web site <http://www.antoniogoncalves.org> | Twitter
> <http://twitter.com/agoncal> | LinkedIn
> <http://www.linkedin.com/in/agoncal> | Paris JUG
> <http://www.parisjug.org> | Devoxx France <http://www.devoxx.fr>