Create working lobby

I want to create a project that is kind a similar to this one: http://memorygame.icefaces.org/memorygame/
Well, in principal anyway. I created a lobby, works great, I can create rooms and others can see it. But when I try to join, first user joins OK, but then second user tries to create new room, and joins the same room or I get some nasty errors.
Anyways, I think I can manage that, my bigger problem is, if I hard code one room into the app, users can join fine, but when one user updates something in the page, the other user can’t see it. I managed to make it work that the other user can see the change after a page refresh.
Anyhow, I tried a lots of thing, none work too good, so I wont even post source code, I just want to ask some advice how I should deal with the task?
To clarify: I want a lobby, users can choose to join an existing “room” or create a new one. Then, from that point on, the users in the same room should see exactly the same thing (well, maybe a few objects should be unique to the user), if one user clicks a button that for example brings up a new Label, the other x users should see it immediately, without the need of manually refreshing the browser.

Sorry if it had been answered before, in that case please point me to the direction. I tried to search, but didn’t find any useful info.

I’ve found on a post the Refresher and ICEPush addo, guess i’ll need those.

But I went back doing my lobby, and got the same error again. The strange thing is that it’s a totally random error. I get all the errors below, stop the server, then restart it without ANY modification in the code, and works fine. Then 3-6 restart later it gives me these errors again…

WARNING: Cannot serialize session attribute com.vaadin.terminal.gwt.server.WebApplicationContext for session 5639642FED152481B80CD7688AF4A77A
java.io.NotSerializableException: hu.java.Project.Logic.SingletonClass
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)

2011.04.10. 16:43:09 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application
[/Project] registered the JDBC driver [com.mysql.jdbc.Driver]
but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2011.04.10. 16:43:09 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application
[/Project] created a ThreadLocal with key of type [java.lang.ThreadLocal]
(value [java.lang.ThreadLocal@c0fe89a]
) and a value of type [org.eclipse.persistence.internal.jpa.EntityManagerImpl]
(value [org.eclipse.persistence.internal.jpa.EntityManagerImpl@686fdca5]
) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
2011.04.10. 16:43:12 org.apache.catalina.session.StandardManager doLoad
SEVERE: IOException while loading persisted sessions: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: hu.java.Project.Logic.SingletonClass
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: hu.java.project.Logic.SingletonClass
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1332)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at java.util.LinkedList.readObject(LinkedList.java:964)

… 1 more
2011.04.10. 16:43:12 org.apache.catalina.session.StandardManager startInternal
SEVERE: Exception loading sessions from persistent storage
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: hu.java.project.Logic.SingletonClass
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1332)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at java.util.LinkedList.readObject(LinkedList.java:964)

… 1 more
2011.04.10. 16:43:12 org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name
[/Project] is completed

I’d like to think this is just because of the frequent restart of the server, and the created objects didn’t get to be unregistered properly, so it’s just a collision in the memory or something like that. Nothing to do with my actual app, right?

Anyway, still trying to do a decent lobby. I tried to map users with the rooms in a hashmap, but that didn’t really work.
It’s like this: HashMap<String, Room> map = new HashMap<String, Room>(); where the String objects are the name of the users, and the Room class is a class that represents a room. From the lobby, through a SingletonClass a Room is created, and the user goes to another page. the singleton class only manages the creation of the room,s because I don’t want in any way a duplicate room or for the rooms to be unsyncronized. Is this a good way to go?

You might want to take a look of
this outdated game of Go example
. While as the example is released in 2002 and do not work with Vaadin directly, most of the code should work and it is fairly well documented.

If you want to port this example to Vaadin (and release it), it would be great. In order to do so, you would have to implement client-side rendering of the go-board widget. Otherwise the code might work almost directly.

If you want to test the Go game example, download
Millstone Framework
(it is just an old old version of Vaadin) and try out the examples.

Below you can see two screenshots of the example. On the front page you can challenge another player by selecting “challenge” from the list of available players…