Hi guys,
I've made a profiling method:
@Around("tld.mycompany.business.aspects.SystemArchitecture.inServiceLayer() && !tld.mycompany.business.aspects.SystemArchitecture.publicConstructor()")
public Object profileBusiness(ProceedingJoinPoint pjp) throws Throwable {
try {
long start = System.currentTimeMillis();
String name = pjp.getSourceLocation().toString() + " " + pjp.getSignature().getName();
Object output = pjp.proceed();
long elapsedTime = System.currentTimeMillis() - start;
if(elapsedTime > 100)
System.err.println("TimerAspect: Businessmethod " + name + " execution time: " + elapsedTime + " ms.");
return output;
} catch (Exception ex) {
ex.printStackTrace(System.err);
throw ex;
}
}
And defined the pointcuts in tld.mycompany.business.aspects.SystemArchitecture as
@Pointcut("execution(public new(..))")
public void publicConstructor() {}
and
@Pointcut("within(tld.mycompany.business..*Impl) &&
!execution(private * tld.mycompany.business.*.dataType()) &&
!handler(java.lang.Exception)")
public void inServiceLayer() {}
I want to profile all methods in my service layer that aren't constructors and exceptions (so that I don't get the "around on initialization not supported (compiler limitation)" and "around on pre-initialization not supported (compiler limitation)" warnings) and ignore dataType() that I've got in a few.
However, I still get the warnings about the constructor and exceptions. It also seems to advice just about any Java method there is, so debugging my application has become close to impossible as I hit many advices for every line. Eclipse tells me it has 2747 advices for the profileBusiness line alone.
Clearly I must have misunderstood something, but what? How can I make it specifically to being Around all methods (except for constructors) in the classes within the tld.mycompany.business hierarchy that end with Impl?
Cheers
Nik