AspectJ - How to instruemt methods that are very very big

157 views Asked by At

I have a generic Java agent based on AspectJ that instruments methods with a certain structure. The agent should be able to work with any Java web application.

The problem - in case the method the agent tries to instrument is very very big, the generated byte code might be greater than 64k --> and as a result the instrumentation will fail, since the JVM doesn't support such methods.

Is there any way to handle such cases? I cannot control the actual application code, only the agent.

An example related to JSPs:

pointcut getJSPRequests(HttpServletRequest req, HttpServletResponse resp):
        args(req, resp) && execution(void _jspService(..));

void around(HttpServletRequest req, HttpServletResponse resp):
        getJSPRequests(req, resp) {
     callSomeMethod(thisJoinPointStaticPart.getSignature(), req, resp);
     proceed(req, resp);

}

Thanks,

Lin

0

There are 0 answers