RequestFactory - Intermittent "The AutoBean has been frozen" on newly created

276 views
Skip to first unread message

Jeff Rodriguez

unread,
Dec 28, 2011, 12:37:10 AM12/28/11
to google-we...@googlegroups.com
I'm running the Request Factory client code below. The first time I invoke it, I receive an IllegalStateException: The AutoBean has been frozen.
Subsequent invocations work just fine.

The odd thing is, the object is created whether I get the exception or not.

If I do get the exception, none of the receiver callbacks get fired.

We're running GWT 2.4.0 on GAE 1.6.1.


        GroupDealService ctx = requestFactory.groupDealService();
        GroupDealProxy gdp = ctx.create(GroupDealProxy.class);
       
        ctx.edit(gdp);
       
        gdp.setName("Foo");
       
        ctx.addOrUpdate(gdp).fire(
            new Receiver<GroupDealProxy>() {
                @Override
                public void onSuccess(GroupDealProxy groupDeal) {
                    Log.info("GroupDealEditActivity.activate.onSuccess");
                    placeController.goTo(new GroupDealIndexPlace());
                }

                @Override
                public void onFailure(ServerFailure error) {
                    Log.info("GroupDealEditActivity.activate.onFailure" + error.getMessage());
                    super.onFailure(error);
                }
            }
        );

Aidan O'Kelly

unread,
Dec 28, 2011, 10:30:17 AM12/28/11
to google-we...@googlegroups.com
Well, one thing to be aware of is, that RequestContext.edit(), returns a new, mutable version of the proxy, rather than unlocking the one you pass in, so instead of :

ctx.edit(gdp); 
gdp.setName("xxx"); 

It should be, 

gdp2 = ctx.edit(gdp); 
gdp2.setName("xxx");

That still doesn't explain why you are getting the error though, because when you create() a proxy on the client side, its already mutable, so you don't in fact need to call edit() on it at all. (and doing so should be harmless afaik) 


Jeff Rodriguez

unread,
Dec 28, 2011, 11:34:39 AM12/28/11
to google-we...@googlegroups.com
Hi Aidan, thanks for the reply.

I just tried with the corrected edit() call, and I'm seeing the same behavior as before.

If I remove the edit call entirely, it also behaves the same.

I've noticed that it actually behaves a bit more erratically than I first thought. Not every subsequent call succeeds.

Aidan O'Kelly

unread,
Dec 28, 2011, 12:09:53 PM12/28/11
to google-we...@googlegroups.com
From the code you posted, it should work fine (even the original code). Is it all executed in one function? It sounds like there's some paths of execution which differ from it, and somehow end up calling setName() on a frozen proxy.  

Jeff Rodriguez

unread,
Dec 29, 2011, 11:38:25 AM12/29/11
to Google Web Toolkit
Yeah, I put that code into a click handler for a button so I can just
repeatedly fire it off. It's the only code in the function.

It seems like something is trying to edit the result before my
receiver callbacks are called. I say that because it works on the
server side every single time. If I click that button 5 times, I'll
end up with 5 entities in my data store.

Aidan O'Kelly

unread,
Dec 29, 2011, 3:38:02 PM12/29/11
to google-we...@googlegroups.com
In your addOrUpdate() method, check to see you are returning the exact same instance that was passed in, just remembered I did actually run into the same problem when you return a different instance that has the same identity. 


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


Thomas Broyer

unread,
Dec 29, 2011, 5:56:14 PM12/29/11
to google-we...@googlegroups.com
I confirm the need to always use the same instance on the server side in a given request. I do believe it's a bug though fwiw.

Jeff Rodriguez

unread,
Dec 30, 2011, 12:02:58 PM12/30/11
to Google Web Toolkit
That was it.

*facepalm*

Thanks for the help guys.
Reply all
Reply to author
Forward
0 new messages