synchronization problem with rpc calls
Hi,
-- my chess application allows users to create game invitations to other users. To accept such an invitation, the invited user has to click on a hyperlink/anchor called "Accept". This will trigger a RPC call to the server, and the server will create a new game based on the invitation.
However, sometimes two games are created for the same invitation, with nearly the same starting time. The starting times differ in less than a second.
My assumption is the following: The invited user made a double click on the hyperlink, which caused the browser to generate two rpc calls. Is this possible? I would have expected that a browser will not generate a second HTTP request while another one is pending? Would you agree that this the explanation for the problem?
If so, then there is a piece of code on the server that gets executed in different threads, i. e. in parallel, potentially. So we need a kind of semaphore, to detect if we are actually creating a game for an invitation, where another game is already created in another thread.
What would be a good, elegant approach to do that? In theory we need some atomic test-and-set method. In single-threaded code we used a static variable. But how do we do this in muti-threaded GWT/RPC-code?
Thanks
Magnus
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 google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home