This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Communication between Servlet and Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Communication between Servlet and Thread" Watch "Communication between Servlet and Thread" New topic
Author

Communication between Servlet and Thread

Gareth Western
Ranch Hand

Joined: Apr 07, 2004
Posts: 45
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

Joined: Jun 06, 2006
Posts: 161
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()


Error: Keyboard not attached. Press F1 to continue.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Communication between Servlet and Thread
 
Similar Threads
Chron jobs?
Starting process threads when Tomcat starts
passing information between servlets
User created threads in serlvets
anybody have experience purchasing voucher from this link?