[jboss-user] [JBoss AOP] - Re: Acting on class load

kabir.khan@jboss.com do-not-reply at jboss.com
Wed Oct 29 07:51:14 EDT 2008


AOP out of the box does not support this. If you are running in JBoss AS with -javaagent, you can add an addidional transformer to PluggableInstrumentor's Instrumentation as shown here
https://svn.jboss.org/repos/jbossas/projects/aop/branches/Branch_2_0/asintegration-core/src/main/org/jboss/aop/asintegration/core/AspectManagerServiceDelegateJDK5.java

When running standalone with -javaagent, rather than using PluggableInstrumentor, you use https://svn.jboss.org/repos/jbossas/projects/aop/branches/Branch_2_0/aop/src/main/org/jboss/aop/standalone/Agent.java[/url] instead, which unfortunately does not allow you access to the Instrumentation. I have added support for this in svn. [url]https://jira.jboss.org/jira/browse/JBAOP-672


  | [kabir@~/sourcecontrol/jboss-aop/trunk/subversion]
  | $svn diff  aop/src/main/org/jboss/aop/standalone/Agent.java 
  | Index: aop/src/main/org/jboss/aop/standalone/Agent.java
  | ===================================================================
  | --- aop/src/main/org/jboss/aop/standalone/Agent.java	(revision 79975)
  | +++ aop/src/main/org/jboss/aop/standalone/Agent.java	(working copy)
  | @@ -35,9 +35,16 @@
  |   */
  |  public class Agent
  |  {
  | +   private static Instrumentation instrumentation;
  | +   
  | +   public static Instrumentation getInstrumentation()
  | +   {
  | +      return instrumentation;
  | +   }
  |  
  |     public static void premain(String agentArgs, Instrumentation inst)
  |     {
  | +      instrumentation = inst;
  |        StandaloneClassPoolFactory factory = new StandaloneClassPoolFactory(); 
  |        AspectManager.setClassPoolFactory(factory);
  |        // necessary for configuration
  | 

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

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



More information about the jboss-user mailing list