Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Push events from Server to client - when and how

 
vishal chang
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I guess this is more of a design question than a programming one but is related to servlets...

In our application, Javawebstart GUI - Servlet (Jetty), our server sends a lot of 'events' to keep the GUI uptodate of the changes at the backend. Events are nothing but XML messages containing objects translated to XML sent out as http chunks asynchronoulsy.
Now since our application has grown we have 100 and 1000s of these events flooding the GUI.
I was wondering how people handle the following,
1. How do you keep clients updated with asynchronous changes caused due to other interfaces or other threads on the server.
2. When a cilent request comes in and you want to return immediately since the operation reqesut is time-consuming you spawn a thread from the reques thread and let the request thread complete. How do you later detemine how to and when to update the client with what has changed. Is there a standard way of doign it..like some design pattern, strategies etc.
3. Events in our case are thrown at several levels - one level directly below the servlet or serveral levels below it. If a call comes from servlet I dont want my lower layers to throw event, my servlet shall do it. But call to lowerlayers can come from places other than a servlet like seperate threads in the app etc. Is there a standard way or popular way of differentiating such calls.

Thanks in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65542
110
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"anotherdeveloper fromothermother",please check your private messages for an important administrative matter.
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!