IcePush Stop Thread


i’m developing a application that starts a thread on the server to connect to a socket, then the data received from the socket is pused to the UI, my problem is when the browser closes the thread keep pushing data meaning that the socket connection is still alive.

I’ve searched the forum and used several verifications to check is the client is still open but no good.

Some methods I´ve tryed


Does anyone know a way to chek if the client application is stiil open?

Paulo Mendes

how about overriding close() in your application class to stop the second thread?

Overriding the close method will resolve the situation when the user close the browser, but in other situations (network failure, client power down) the thread will still be active.

It must be a way to the thread to detect if the client application is still running.

Paulo Mendes

What ICEPush does is tell your web application to call back for an update (at which time the browser receives the changes that have been accumulated).

So if immediately after a push, if the browser is alive/reachable, it will call your servlet, and you can check that this has happened. You might try to extend the PushServlet to have a timer, and extend the push() method to reset the timer. If the timer expires (say after 5 seconds) then the browser is not there and you can do the cleanup.

I have not looked at the PushServlet in a while, but from memory you need to do the test in the servlet because the request from the browser will be for a /uidl URL and you need to intercept those in the servlet (as I recall – do not take my word on this, go check !)