server side questions

1 view
Skip to first unread message

Jeff Bender

unread,
May 29, 2006, 12:26:11 AM5/29/06
to Google Web Toolkit
I'm developing a multi-player game where the players use an ajax web
page to interface with the server. I need some synchronization on the
server for the case where two players' requests come in at the same
time. Is this possible with servlets under tomcat?
Also, if I were developing the server as a stand-alone application, the
game state information would be stored in memory (just allocated with
new). Am I forced to use a database to store it if I use GWT? There
doesn't seem to be any other way to allow the servlets to share data
with each other. Thanks for any help, I am confused and don't know how
to proceed.

Chiraz

unread,
May 29, 2006, 6:39:13 AM5/29/06
to Google Web Toolkit
Jeff,

For some simplicity, I'd consider using Hibernate together with Derby.

Derby is an embedded database that can run from within the WEB-INF/lib
folder. Hibernate allows you to materialize and persist your data more
or less automatically without too much effort. You can use SQL or the
Hibernate approach to persist data.

If you use database locking in the backend, your servlets can 'share'
information and it keeps the synchronization code within the database
(if you use singletons and synchronized for example, you always lock
out others even if they are not related).

Good luck!

Rgds,

Chiraz

Joel Webber

unread,
May 30, 2006, 5:59:14 PM5/30/06
to Google-We...@googlegroups.com
With respect to synchronization on the server, what Chiraz said makes perfect sense to me.  I would also look into using hanging requests to simulate "server-side push" to the client.  There is some discussion of this technique on this thread: http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/5233cf1fc6f2a1a7

joel.
Reply all
Reply to author
Forward
0 new messages