Harish Krishnaswamy wrote:
Hi,
I decided to do some work on interceptors and wanted to find a suitable solution and so tried out CGLIB and Javassist and here are my initial findings.
1. Ease-of-use / clarity / maintainability - Obviously here, anybody that has done a little bit of Javassist will agree that it is in no way comparable to CGLIB when it comes to ease-of-use. CGLIB is all plain Java and very straight forward and Javassist is on the other end of the spectrum - pieces of string literals patched together to form Java statements.
2. Performance - This is interesting. CGLIB has a disadvantage here due to the number of parameters passed to the intercept method. It turns out, all of the overhead is because of these parameters that cannot be overcome (atleast AFAIK). With a single counter interceptor I could make Javassist as much as ~4 times as fast as CGLIB (~300% faster). And with more interceptors obviously Javassist is more faster. Now, if I insert a method call in the Javassist interceptor with 4 parameters, to my surprise the performance is identical to the CGLIB interceptor. Would be really nice if CGLIB can be designed around this problem.
3. Limitations - There are quite a few limitations with Javassist that can be found on their website primary one for me being not able to debug instrumented classes. I have not come across any such limitations with CGLIB.
From this intial study, it looks to me that we certainly need a way to provide CGLIB interceptors to services. And that's what I'll be doing this weekend. I know Christian has already done some work on this, I'll see if I can reuse it.
-Harish
PS. I can post the code if anybody is interested.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
