Sorry, I haven't dived into the depths of XMLHttpRequest. All I can tell you is your users can continue to modify the objects while the RPC is executing (unless you block them with a dialog or similar), so your objects will not be safe after the RPC, only before it. Maybe someone else here has more knowledge of XMLHttpRequest?
On Mar 25, 11:48 pm, Martin Larsson <[email protected]> wrote: > I need the status on the server (new, deleted, modified), so I must wait > with the modification until I know the objects have been serialized. > Even though Javascript is single threaded, the actual RPC-call is done > with a separate XMLHttpRequest-object, I'm uncertain if the objects are > safe on the code line right after the actual RPC-call. The easiest (at > least for me, but probably also Google) would be if they were. But how > would I know? > > On 25. mars 2011 03:26, Craig Mitchell wrote: > > > > > > > > > Javascript is single threaded, so you can just mark them as clean just > > before you send them. IOW. It won't be possible for them to be > > updated between when they are marked as clean, and when the call to > > save starts. > > > If the save fails, just mark them back to being modified. > > > Note: During the save process on the server, they can be modified. > > > On Mar 24, 4:19 am, Martin Larsson<[email protected]> > > wrote: > >> We're experimenting with background saving in our GWT-app. IOW. we > >> mark objects as 'modified', and then at regular intervals, find all > >> modified objects and pass them to the database for storage. The > >> question is when is it safe to mark the object as 'clean'. The on- > >> success-handler of the save()-method is too late, obviously. That can > >> happen any time later and the user might have modified the object(s) > >> again. As the status also can be 'new' or 'deleted', I need to pass > >> the status to the server so it knows what to do. IOW. I can't mark the > >> object clean too early. What I'd like is to mark them 'clean' when > >> they're safely serialized, and have the on-failure-handler set them > >> back to 'modified' if the save() failed. > > >> So ... is there any point in the code where I can be certain that the > >> objects are serialized and on their way to the server so I can start > >> modifying them in the client without interfering? > > >> Figure 4 here:http://eclipse.dzone.com/news/making-gwt-remote-procedure-ca > >> indicates that the objects are safe once the method in *Async returns. > >> Is that safe? > > >> M. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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-web-toolkit?hl=en.
