[jboss-user] [JBoss AOP] - Inconsistencies between two environments

Earnest Dyke do-not-reply at jboss.com
Wed May 11 09:22:40 EDT 2011


Earnest Dyke [http://community.jboss.org/people/earnest.dyke] created the discussion

"Inconsistencies between two environments"

To view the discussion, visit: http://community.jboss.org/message/604742#604742

--------------------------------------------------------------
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>
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/604742#604742]

Start a new discussion in JBoss AOP at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2027]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110511/e16f4950/attachment.html 


More information about the jboss-user mailing list