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 Servlet threading vs. implementing threads 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 "Servlet threading vs. implementing threads" Watch "Servlet threading vs. implementing threads" New topic

Servlet threading vs. implementing threads

Val Pecaoco
Ranch Hand

Joined: Dec 05, 2001
Posts: 156
Hi Ranchers,
Due to the inherent threaded nature of servlets, do you still need to implement threads in an app, like, say, in connection pooling, or just let the servlet container do the threading for you?
Ex Animo Java!
-- Val

"Knowledge is power, but enthusiasm is the key." -- Lavern Barn
Reuben Cleetus
Ranch Hand

Joined: Jul 13, 2001
Posts: 50
I would still do so for long processes, which can be done asynchronously. Things such as long calculations, data insertions that take a long time, etc., can be done in another object, running in its own thread.
However, such instances are probably not very common, since most data that is saved needs to be done transactionally, where certain actions are taken when it fails, including flagging the user. The problem with doing this asynchronously, is that the saving will be done in another object and thread, so there would be no way of flagging a failure to the user when the page is returned to the user.
I agree. Here's the link:
subject: Servlet threading vs. implementing threads
Similar Threads
multithreading in servlet
New to java
Send response before process is done.
Threading in servlet
Starting threads within Servlets