Re: Entity version checks / optimistic locking
1. In your server, maintain a map of objectId/semaphore. A semaphore
enables locking to be done by a thread and unlocking by another
thread, both atomically.
2. "Edit" means acquiring lock. Send a message from client to server
for acquiring semaphore. If successful, allow editing.
3. Release semaphore on saving.
J.Ganesan
www.DataStoreGwt.com
On Jul 6, 3:26 am, Aldo Neto <tumo...@gmail.com> wrote:
> I apologize for such stupid question, but how can I achieve that? I mean,
> how should I treat the entity on the server side to get that lock? I can
> have the "Edit/Lock" button and that button should work for only one user at
> a time, until that user has committed their work. In this case, how can I
> lock the object? And how do I unlock it?
>
> Again, sorry for the newbie question
>
> Thanks
>
>
>
>
>
>
>
> On Tue, Mar 15, 2011 at 10:41 AM, Thomas Broyer <t.bro...@gmail.com> wrote:
>
> > On Tuesday, March 15, 2011 12:37:14 PM UTC+1, Jens wrote:
>
> >> On Saturday, March 12, 2011 9:58:11 AM UTC+1, Thomas Broyer wrote:
>
> >>> It's even better than that ;-)
> >>> The user has to click a "lock" button to be able to edit the objects
> >>> (creates a working copy). The form then switches to read/write mode and the
> >>> "save" button appears. But the save button only saves changes to the working
> >>> copy; there's a distinct "unlock" button that overwrites the "public copy"
> >>> with the "working copy" (and another "free" button to "unlock" the "public
> >>> copy" and simply discards the "working copy").
> >>> A user can keep his working copy for days, or even weeks or months.
>
> >> Uhh..so if I work on my private copy for 2 weeks and then unlock it to
> >> update the public copy, a second user can destroy my work by unlocking his
> >> copy a day later and thus overwriting my 2 weeks of work? :) Having working
> >> copies is a nice idea but merging them back into one public copy seems
> >> tricky. But of course it depends on the application.
>
> > There's no need to merge, because when you do a working copy, you're
> > locking the public version. The idea of a working copy is that you work in
> > private, and the public version stays the same until you "publish" your
> > work.
>
> > --
> > 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-web-toolkit@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.
--
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home