[jboss-user] [Javassist] New message: "method instrumentation approaches - which is best?"

Arvind K do-not-reply at jboss.com
Sun Jan 10 23:28:14 EST 2010


User development,

A new message was posted in the thread "method instrumentation approaches - which is best?":

http://community.jboss.org/message/519161#519161

Author  : Arvind K
Profile : http://community.jboss.org/people/megalodon

Message:
--------------------------------------------------------------
Hello All,
 
I am sort of new to Javassist and have a design question which has probably been already discussed. I couldn't search and look for the discussion though due to no search facility as far as I could see. Anyway, to state my question,
 
I don't know which instrumentation methods to choose for which situations when it comes to instrumenting many methods in an application during load time. I have 2 approaches in mind:
1. Performing instrumentations directly in the methods using functions like insertBefore(), insertAfter(), addCatch() etc.
2. Renaming name of original method (say, original name) to some unique name (possible conflict issues here), creating a dummy method with the original name, perfoming all insrumentation in dummy method and calling the original method from the dummy.
 
Approach 1 seems to be easier to implement and would perhaps use less resources - no new to create new methods for every instrumented method, no need to make 2 method calls for each original method call and no need for the JVM to store additional method information for the dummy method. We need to create local variables to store any state between insertBefore() and insertAfter() since we cannot access existing local variables and it is not wise to use instance variables for load time instrumentation.
 
Would love to hear your opinions. Thanks.
 
-Arvind

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/519161#519161




More information about the jboss-user mailing list