Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Communication between Servlet and Thread

 
Gareth Western
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a (Struts) servlet which launches a Thread to perform a lengthy process. I'd like the user to be able to make subsequent requests in order to get a progress update from the thread, so they have some idea of how long until the thread completes.

Can someone provide some information on how I could do this? Doesn't have to be a very long explanation, just pointers on where to start looking for more information.

Thanks!

Gareth
 
Travis Hein
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you create the thread, can you place the handle to the thread instance onto the user's session?
Then the same user could see the status, any other page could session.getAttribute() to get the thread and ask thread.isAlive()
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic