[jboss-dev-forums] [Design of EJB 3.0] - Re: EJBTHREE-1800 Improving InjectInterceptorsFactory

jaikiran do-not-reply at jboss.com
Mon Apr 6 04:47:39 EDT 2009


One more place which i think can be improved for performance is the InterceptorRegistry, which currently checks for the presence of any @Interceptor and @InterceptorOrder on the bean classes/methods. Currently, the InterceptorRegistry does the following for method-level logic:

1) Get *all* (public, private, protected etc...) methods on the bean class
2) For each of these methods check for the presence of @Interceptors
3) Build a collection of Interceptor classes applicable to this method (which effectively is default intereceptors, class interceptors and any interceptors declared for that method)
4) Check for the presence of @InterceptorOrder on each of these methods

I think we can improve this logic. The EJB3 spec says:

"EJB3 Spec, Section 12.7" wrote : A business method interceptor method may be defined to apply to a specific business method invocation, rather than to all of the business methods of the bean class.
  | 

So we can improve step#1 to:

1) Get only public methods of a bean class and its super classes (since a business method cannot be anything other than public). This effectively eliminates a lot of irrelevant methods from further processing

No change in logic for step#2 and #3
2) For each of these methods check for presence of @Interceptors 
3) Build a collection of Interceptor classes applicable to this method (which effectively is default intereceptors, class interceptors and any interceptors declared for that method)

A bit of improvement in step#4
4) Only if the collection of interceptor classes for this method is non-empty, then go ahead with the check for @InterceptorOrder. If there are no relevant interceptors for this method then there's no point in checking the @InterceptorOrder


I haven't given this change a try yet - will do now. But any thoughts about this change?

 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4223568#4223568

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4223568



More information about the jboss-dev-forums mailing list