aspose file tools*
The moose likes Servlets and the fly likes Threads in Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Threads in Servlets" Watch "Threads in Servlets" New topic
Author

Threads in Servlets

Girish Babu
Greenhorn

Joined: Mar 18, 2005
Posts: 6
Hi All,

Can any body please let me knw if there is going to be any problem if i create multiple threads in a Servlet,

thanks in advance,
girish
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Servlets are already multi threaded.
What are you trying to do?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Marcos Urata
Greenhorn

Joined: Dec 31, 2004
Posts: 26
I have the same doubt. There is a funcionality on my system that is Download of reports.

The thing is that the download files are quite big (about 50 MB) and are created on the fly. Because it can take a while to download the file, I created some methods to show the status of the download. So, to do that, I created a new thread on my servlet, which main and only purpose is to prepare the report file to be downloaded and zip it on the end.

The html client form is refresh from 5-to-5 seconds, so that they can see the progress of the download.

Is this a good aproach?

Thanks
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

That's how I do it.

I don't create the threads myself because the long running process occurs in the database but the concept is the same.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Threads in Servlets