Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] proceed() with Tomcat 5.5.x

Why proceed(..) ; ?

Try proceed() ;

 

Cordialement / Best regards

 

Jean-Louis Pasturel
jeanlouis.pasturel@orange-ftgroup.com

 


De : aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] De la part de Tyler DeWitt
Envoyé : vendredi 13 juin 2008 00:43
À : aspectj-users@xxxxxxxxxxx
Objet : [aspectj-users] proceed() with Tomcat 5.5.x

 

Hello all,
   Thanks to all the help I've already received from this ML.  My newest problem is with an around() and proceed() call.  I am writing a monitoring tool and for the CPU usage I am using the time it takes for a method to execute.  I was the around advice to record when the method is called.  I then call proceed and when the method returns (to the around advice), I record the completion time.  My advice works on Tomcat 6.0 but when I copied the exact same jar (containing the compiled aspect and aop.xml file) to a different server running Tomcat 5.5 I get an error that one of my classes is not defined.  When I looked at catalina.out I saw an error that I was matching a join point that did not return void, so I changed my pointcut to only find void methods.  The error no longer appears in teh log, but when I attempt to load the page I get an HTTP 500 error explaining that my class could not be found (the class just makes an empty array).  I've included some snippets of code if anybody sees my mistake.  The after() advice is for debugging and successfully inits the servlet before the error stops the loading.  The package is com.salhadef

<code>
import java.util.Date;

public aspect TimerTest{
    pointcut greeting():
        execution(void com.alhadef.*.*(..));
   

    after() returning() : greeting()
    {
        System.out.println(new Date() + " ASPECT: Exiting: " + thisJoinPoint);
    }

    void around(): greeting()
    {
        System.out.println("DEBUG: In around advice");
        long start = getTime();
        System.out.println("DEBUG: start = " + start);
        proceed(..);
        System.out.println("DEBUG: proceed comlpete");
        long timeTaken=getTime()-start;
        System.out.println("TIMER: "+ new Date()+" "+ thisJoinPoint + " took: " + timeTaken + "millisec." );
       
       
    }

    public long getTime()
    {
        return System.currentTimeMillis();
    }
     
}

</code>

Thanks so much!
Tyler

*********************************
This message and any attachments (the "message") are confidential and intended solely for the addressees.
Any unauthorised use or dissemination is prohibited.
Messages are susceptible to alteration.
France Telecom Group shall not be liable for the message if altered, changed or falsified.
If you are not the intended addressee of this message, please cancel it immediately and inform the sender.
********************************

Back to the top