Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] perJoinPoint

Problem is, that I would like to develop for example counter for every method
specified by pointcut. This mean I have to keep specific state for every joinpoint
somewhere (e.g. HashMap<JoinPointStatic, Counter>). Instead of very simple:
aspect A perJoinPoint(traceCount()) {
    int count=0;
    before() : traceCount() {
        count++;
    }
}

I have to handle around HashMap getting, initializing Counters, ...
Code isn't huge (maybe 20 lines more) but less efficient (slower).

However I hope one of clever guys reading this mailing list will solve it.

TNX

Pavel

On Thu, 2005-03-24 at 08:40 -0800, Wes Isberg wrote:
Does this not work?

-----
aspect A {
  void trace(JoinPoint.StaticPart jp) { .. }

  // method-execution 
  before() : execution(* *(..)) && !within(A) {
     trace(thisJoinPointStaticPart);
  }
  // or, if you want advice-execution 
  // be careful if other advice advises this
  before() : adviceexecution() && !within(A) {
     trace(thisJoinPointStaticPart);
  }
}
------

Wes

------------Original Message------------
From: Ťavoda Pavel <Pavel.Tavoda@xxxxxxxxxx>
To: aspectj-dev@xxxxxxxxxxx
Date: Thu, Mar-24-2005 3:07 AM
Subject: [aspectj-dev] perJoinPoint
Is it possible to achieve something like perJoinPoint aspect?
I would like to calculate some statistics for method execution.

TNX

Pavel 

_______________________________________________
aspectj-dev mailing list
aspectj-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-dev


Ing. Pavel Tavoda
+421 2 5822 6540
Spordat s.r.o


Back to the top