Hi,

I hope this is the right forum to also ask questions about the Autobeans 
framework, if not please do redirect me!

We're using autobeans both in client code and server code, and so far 
things work nicely except in one situation: sometimes parsing autobeans 
simply fails with a stack trace similar to this:
java.lang.NullPointerException
at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.makeProxy(
ProxyAutoBean.java:105)
at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.createShim(
ProxyAutoBean.java:393)
at com.google.web.bindery.autobean.vm.impl.ProxyAutoBean.as(ProxyAutoBean.
java:222)
at com.google.web.bindery.autobean.vm.impl.ShimHandler.maybeWrap(ShimHandler
.java:113)
at com.google.web.bindery.autobean.vm.impl.ShimHandler.invoke(ShimHandler.
java:91)
at com.sun.proxy.$Proxy368.get(Unknown Source)
at com.google.web.bindery.autobean.shared.impl.SplittableSimpleMap$1$1$1.<
init>(SplittableSimpleMap.java:90)
at com.google.web.bindery.autobean.shared.impl.SplittableSimpleMap$1$1.next(
SplittableSimpleMap.java:86)
at com.google.web.bindery.autobean.shared.impl.SplittableSimpleMap$1$1.next(
SplittableSimpleMap.java:76)
at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.google.web.bindery.autobean.vm.impl.ShimHandler.invoke(ShimHandler.
java:85)
at com.sun.proxy.$Proxy347.next(Unknown Source)
at XXX.function(XXX.java:...)

When dumping the contents of the bean at that point everything looks 
proper, and it can be parsed just fine in an isolated unit test. After some 
more investigation I managed to reproduce this and other similar 
exceptions: it seems to happen when multiple threads access a recently 
created autobean proxy.

I understand that autobean's are actually parsed lazily, so for me this 
looks like a concurrency issue somewhere inside the autobeans framework 
itself. I didn't see any notes about sharing autobeans between threads in 
the documentation, so:
1. Should it be possible to share them, or is additional synchronization in 
the application code needed? 
2. Instead of synchronizing all accesses, would it be enough to force a 
full parse run of the autobean before making it visible to other threads?
3. Is this problem only affecting server-side code, or would similar issues 
also be possible in client-side code? (I'm suspecting: "It depends on the 
browser's implementation of JS?")

Regarding the second question: I did not manage to reproduce the issue by 
using this additional code:
AutoBeanUtils.getAutoBean(delegate).accept(new AutoBeanVisitor() { /* 
Nothing */ });

Regards,
--
Andreas

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to