2 Replies Latest reply on May 13, 2011 2:22 PM by earnest.dyke

    Inconsistencies between two environments

    earnest.dyke

      Greetings all,

       

      I have create a simple aspect (see below) which is deployed as a .jar file and the associated *-aop.xml file (also below). If I deploy these on my local EAP 5.0 32-bit server with JDK 1.6.0 I get all of the logged methods executions I expect. If I deploy the same .jar and *-aop.xml to my EAP 5.0 64-bit server I only get some of the method executions logged. I have set verbose=true in conf/bootstrap/aop.xml but see nothing that would indicate why this is happening.

       

      Any one have any ideas? I am stuck at this point.

       

      Thanks in advance for any and all pertinent responses.

       

      Earnie!

       

       

      TimingAspect.java

       

      package com.ferguson.performance;
      
      import java.lang.reflect.Method;
      
      import org.jboss.aop.joinpoint.MethodInvocation;
      import org.jboss.logging.Logger;
      
      public class TimingAspect {
          private static Logger log = Logger.getLogger(TimingAspect.class);
          private static Long cnt = 01l;
      
          public Object timeExection(MethodInvocation invocation) throws Throwable {
              long id = 0l;
              String method = null;
              if (invocation.getTargetObject() == null) { // static method call
                  Method m = invocation.getActualMethod();
                  String[] classParts = m.getDeclaringClass().getName().split("\\.");
                  String[] methodParts = m.getName().split("\\$");
                  method = m.getDeclaringClass().getName() + "."
                          + methodParts[classParts.length];
              } else {
                  method = invocation.getTargetObject().getClass().getName() + "."
                          + invocation.getMethod().getName();
              }
              synchronized (cnt) {
                  cnt++;
                  id = cnt;
              }
              long startTime = System.currentTimeMillis();
              log.info("Start: " + id + " " + method);
              try {
                  return invocation.invokeNext();
              } catch (Exception e) {
                  log.error("Timing error",e);
                  return null;
              } finally {
                  long endTime = System.currentTimeMillis();
                  log.info("End: " + id + " " + (endTime - startTime));
              }
          }
      }
      

       

      *-aop.xml deployed separately.

       

      <?xml version="1.0" encoding="UTF-8"?>
      <aop xmlns="urn:jboss:aop-beans:1.0">
          <aspect class="com.ferguson.performance.TimingAspect" />
          <bind pointcut="execution(* com.ferguson.gateway.business.*->*(..)) OR execution(* com.ferguson.gateway.dao.*->*(..))">
              <around aspect="com.ferguson.performance.TimingAspect"  name="timeExection" />    
          </bind>
      </aop>
      
        • 1. Inconsistencies between two environments
          earnest.dyke

          As an update, it appears the the version that is "not working correctly" is only working for private methods. No log entries exist for public methods.

           

          Earnie!

          • 2. Inconsistencies between two environments
            earnest.dyke

            In an effort to determine why this is not working, I have now deployed my aspect in all of the three possible deployment options:

             

            1. As above with a .jar and a separate *-aop.xml file
            2. As a .aop file with a jboss-aop.xml in the META-INF directory
            3. As a .aop file with Annotated aspect class and an empty jboss-aop.xml in the META-INF.

             

            All three work as expected in my 32 bit JBoss EAP 5.0 environment but I only get weaving in my 64 bit JBoss EAP 5.0 environment for static methods.

             

            Still seeking help with this weirdness.

             

            Earnie!