Hi,
I'm seeing some strange behavior. I have a MethodInterceptor that I
use to collect timing information on method calls. It works great,
except it doesn't seem work consistently. Without changing any code,
it will work on some runs and not on others.
More specifically, I have two classes (say Foo & Bar) that extend from
a base class (say Base). Sometimes the method interceptor will work
on one, but usually not both. I ran it using a debugger and noticed
that the backtraces are significantly different between when it works
and when it doesn't. It seems that maybe something is going wrong
with code generation for the wrapper class?
Below are some simplified examples of my classes, interceptor code,
and the backtraces I'm seeing.
Any help is appreciated.
Thanks,
Jesse
=====Foo =====
class Foo extends Base {
public Foo() {
super()
}
}
===== Bar =====
class Bar extends Base {
public Bar() {
super()
}
}
===== Base =====
class Base {
public Base() {
new Thread(this).start();
}
public void run() {
doWork()
}
@TimeLogged
protected void doWork() {
}
}
===== Injection Code =====
bindInterceptor(Matchers.subclassesOf(Base.class),
Matchers.annotatedWith(TimeLogged.class),
new TimeLoggerIntercepter());
===== Broken Backtrace =====
Foo$$EnhancerByGuice$$4b1ef8b7(Base<T,V>).doWork(HashMap<File,V>)
line: 283
Foo$$EnhancerByGuice$$4b1ef8b7.doWork(HashMap) line: not available
Foo$$EnhancerByGuice$$4b1ef8b7(Base<T,V>).run() line: 188
Foo$$EnhancerByGuice$$4b1ef8b7.run() line: not available
Base$1.run() line: 48
Thread.run() line: 619
===== Working Backtrace =====
Bar$$EnhancerByGuice$$78113831(Base<T,V>).doWork(HashMap<File,V>)
line: 283
Bar$$EnhancerByGuice$$78113831.CGLIB$doWork$20(HashMap) line: not
available
Bar$$EnhancerByGuice$$78113831$$FastClassByGuice$$ae4cd253.invoke(int,
Object, Object[]) line: not available
MethodProxy.invokeSuper(Object, Object[]) line: 228
InterceptorStackCallback$InterceptedMethodInvocation.proceed() line:
64
TimeLoggerIntercepter.invoke(MethodInvocation) line: 32
InterceptorStackCallback$InterceptedMethodInvocation.proceed() line:
64
InterceptorStackCallback.intercept(Object, Method, Object[],
MethodProxy) line: 44
Bar$$EnhancerByGuice$$78113831.doWork(HashMap) line: not available
Bar$$EnhancerByGuice$$78113831(Base<T,V>).run() line: 188
Bar$$EnhancerByGuice$$78113831.CGLIB$run$8() line: not available
Bar$$EnhancerByGuice$$78113831$$FastClassByGuice$$ae4cd253.invoke(int,
Object, Object[]) line: not available
MethodProxy.invokeSuper(Object, Object[]) line: 228
ProxyFactory$1.intercept(Object, Method, Object[], MethodProxy) line:
53
Bar$$EnhancerByGuice$$78113831.run() line: not available
Base$1.run() line: 48
Thread.run() line: 619
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en.