• Post Reply Bookmark Topic Watch Topic
  • New Topic

can thread with servlet class  RSS feed

 
bakiyalakshmi dhanraj
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a Java Thread be started from Servlet class, and what will be
the implications?
 
Tim LeMaster
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you start one? Sure. However its not recommended.

Many app servers have access to thread pools that can be managed by the app server like Websphere/Weblogic and commonj.

Also you depending on what you want to do the servlet could send a message to a message driven bean.
 
Henry Wong
author
Sheriff
Posts: 23280
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you start one? Sure. However its not recommended.


Agreed. Not recommended.

However, having visited and supported many many clients applications -- with servlets -- starting a thread is incredibly common. In fact, I don't think I know of one production servlet that doesn't start threads. I know of a few small testing servlets, but every large production app, creates internal thread pools and/or create temporary threads.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!