[jboss-user] [JBoss AOP] - Maybe I just don't get it

chip_schoch do-not-reply at jboss.com
Tue May 13 09:26:11 EDT 2008


I have a service that I want to instrument to do some diagnostics.  I thought that this presented a good opportunity to come up to speed on AOP.

1.  I created an interceptor class .

@InterceptorDef
  | @Bind (pointcut = "execution(public Boolean com.eLynx.Service.PackageProcessing.PackageProcessingMessageHandler->processMessage(..))")
  | public class ProcessMessageInterceptor implements Interceptor
  | {
  | 
  |     /**
  |      * Method: getName
  |      *
  |      *
  |      * @return
  |      */
  | 
  |     public String getName ()
  |     {
  |         return "ProcessMessageInterceptor";
  |     }
  | 
  |     public Object invoke (Invocation invocation) throws Throwable
  |     {
  |         try
  |         {
  |             System.out.println ("<<< Entering ProcessMessageInterceptor");
  |             return invocation.invokeNext ();
  |         }
  |         finally
  |         {
  |             System.out.println (">>> Leaving ProcessMessageInterceptor");
  |         }
  |     }
  | }

2.  I enabled loadTime weaving and added the pluggable-instrumentor.jar

3.  I scoped my interceptor deployment to the same as the service with the method I want to intercept.

  | <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  | <aop>
  | 	<loader-repository>com.eLynx:loader=PackageProcessingService</loader-repository>
  | </aop>
  | 

4.  I packaged up my interceptor class and -aop.xml file in a jar with .aop extension.  The xml file is in a META-INF directory.

5.  I deploy the .aop file and the deployer picks it up.  It logs that it is using the class loader I expect.

6.  I invoke the method I want intercepted and noting happens.

The method I want intercepted is:

  |     @Override public boolean processMessage (Message aMessage,
  |                                              MessageReceiver aMessageReceiver)
  |     {
  |       ...
  |      }

I don't really now what to do now.  Any ideas?


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

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



More information about the jboss-user mailing list