Hi folks!

I'm currently hanging over the interceptors spec and found a few pretty 
interesting details:

If a user invokes a method on a contextual instance, then _only_ business 
method interceptors (InterceptionType.AROUND_INVOKE) must get invoked.

Any POST_CONSTRUCT, AROUND_TIMEOUT, PRE_DESTROY, etc system event interceptor 
must _only_ get called for system invoked calls. 
Thus if a user manually calls e.g. a @PostConstruct method, then the 
POST_CONSTRUCT interceptor will _not_ get invoked for this call! Only if it get 
invoked by the container...

Thus we need to really split this out in our InterceptorHandler 


a.) EJB-style interceptors: executed on business method calls and _always_ 
before cdi-style (@InterceptorBinding) interceptors and decorators

b.) CDI-style interceptors executed on business methods

c.) system event interceptors (@PostConstruct, @PreDestroy, @AroundTimeout, 
etc) which must _only_ get called if invoked by the container. They also can be 
private!



This means that we will generate our interceptor proxies only for the business 
methods. All other methods will get their own handlers. If the 
ContextualInstance is instanceof OwbInterceptor then we will always invoke them 
through the InterceptorHandler.

I suggest we introduce a few methods likeĀ  invokePostConstruct, 
invokePreDestroy etc in the InterceptorHandler and a helper method to get the 
InterceptorHandler from those proxies. 


LieGrue,
strub

Reply via email to