Double counts

18 views
Skip to first unread message

martin...@csgi.com

unread,
Jan 8, 2013, 9:35:55 AM1/8/13
to java...@googlegroups.com
When adding the @Monitored annotation to a method of a class that is advised by another aspect (e.g., @Transactional), counts are doubled.

The problem is caused by not only the original class is advised; but also the cglib generated proxy is as well.

I modified the  MonitoredMeasuringPointcut to include a check for the target class being a cglib proxy.

Here is the modified method of the MonitoredMethodMatcher enum:

@Override
public boolean matches(Method method, Class targetClass) {
return ((!ClassUtils.isCglibProxyClass(targetClass)) && ((AnnotationUtils.findAnnotation(targetClass, Monitored.class) != null) || (AnnotationUtils
.findAnnotation(AopUtils.getMostSpecificMethod(method, targetClass), Monitored.class) != null)));
}
:


Richard Richter

unread,
Jan 8, 2013, 11:09:30 AM1/8/13
to java...@googlegroups.com
Hi Martin and welcome to our group

I've just found your issue and asked you for patch/code. Now I see
this message, so please, disregard the comment in the issue. Thank you
for findings and for the code. It will be commited to the trunk soon.

Virgo
> --
> You received this message because you are subscribed to the Google Groups
> "javasimon" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/javasimon/-/A2_zzoXKIwAJ.
> To post to this group, send email to java...@googlegroups.com.
> To unsubscribe from this group, send email to
> javasimon+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/javasimon?hl=en.
Reply all
Reply to author
Forward
0 new messages