Hi ky,
You're probably more likely to get a better reply on the tomcat-users
mailing list since this issue has more to do with using Tomcat rather than
working with GWT.

You can find a link to the tomcat-users mailing list at the link below:
http://tomcat.apache.org/lists.html#tomcat-users

However, I did want to mention that what you're trying to do could
definitely benefit from a comet design approach to your application, which
as I read it, isn't what you're currently using. You can find some great
details about using Comet with GWT on the thread linked below just in case
you wanted to learn more about the design and possibly use it for your
application.

Using Comet with GWT:
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/97d49bf5a3caa6ff/ebf84a76d9c63af7

Hope that helps,
-Sumit Chandel

On Thu, Oct 16, 2008 at 12:56 PM, ky <[EMAIL PROTECTED]> wrote:

>
> I wrote a very basic webapp that synchronizes a data model on a server
> between many clients. Essentially, the model is the position of a
> dialog box that clients can move a box around on their screen. When a
> move occurs, that change is sent to the server and all other clients
> immediately see the box update to its latest position on their screens
> as well.
>
> The way I implemented this is through these methods:
>
> In DataServiceImpl.java, there is the getLatestModelFromServer()
> method. The client calls this method through RPC to receive model
> updates from the server when any changes are made.
>
> In the client code, whenever the client drags the dialog box and
> releases (onmouseup), the client calls the updateServerModel() method
> through RPC.
>
>
> In getLatestModelFromServer(), there is the following loop:
>
> while(!thereAreUpdates) {
>   wait();
> }
> // after update occurs, return the latest server model to the client.
>
>
> In updateServerModel(), whenever a client updates the server's model
> (i.e. the coordinate position of the dialog box), the method calls
> NotifyAll() and sets thereAreUpdates to true, which makes all clients
> waiting for a response from getLatestModelFromServer() get the latest
> model. When they do, these clients call getLatestModelFromServer()
> again (in the onSuccess method of the callback). Thus, clients always
> have a persistent connection with the server, always waiting for
> updates.
>
> The code works as designed, concurrency issues aside. One client can
> drag the dialog box anywhere and when he releases the drag, all other
> clients connected to the server through getLatestModelFromServer()
> receive the new coordinates and see their box move from the old
> position to the new one. But here is my problem:
>
>
> In Tomcat Manager, one persistent request per client is created while
> the webapp is running. However, when I close all the web browser
> windows, the following shows up under Server Status:
>
> POST: /[application name]//DataService HTTP/1.1
>
> ...and it shows up one per client I used! The oddest thing is, even
> when I completely reload the application context, these ghost
> connections are still there. I cannot get rid of these without
> restarting the entire Tomcat server.
>
> I must not be understanding something because I thought reloading the
> context resets this kind of thing. Does anyone know why these
> connections persist even after the browser windows are closed and the
> application is reloaded? Is there any way to terminate these
> connections? Each ghost connection costs a thread =(
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to