Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Lifecycle management of servlets

 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we say, that, the Container controls the life and death of servlets? Since servlets are not object?

Thanks in Advanced!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65340
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abimaran Kugathasan wrote:Since servlets are not object?

Ummmm, yeah, they are. What did you think they were?
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Ummmm, yeah, they are. What did you think they were?


Thanks Bear Bibeault! I found that, they(servlet) also, a object, and when a request come to a particular servlet, the container creates a Thread, and the Thread will communicate with the servlet, this from Head First JSP ans Servlet book, but I didn't noticed any Thread when the application is running? Is it implicitly functioning?

Thanks in Advanced!
 
Ankit Garg
Sheriff
Posts: 9580
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't noticed any Thread when the application is running?

A thread is automatically created by the container to serve every incoming request. How did you check if there were any threads running in the application??
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Garg wrote:
..How did you check if there were any threads running in the application??


, there are no references to refer them! No invocation of any start(), run(). That's why I asked! Thanks Ankit!
 
Rajeev Rnair
Ranch Hand
Posts: 310
1
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One responsibility of the container (among several others) is the Thread Management. The container (eg: Tomcat) will maintain a pool of Thread objects or create new Threads as and when needed. In the case of new servlet request comes in from user, it will either create a new Thread or assign a Thread from the Thread pool to serve this request! Container will call the start() method.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rajeev Rnair, I got it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic