This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

service() vs thread starting

 
Mamadou Touré
Ranch Hand
Posts: 189
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,

I'm a little bit confused.
Is the service() a mthod in each thread, or is it just in the servlet instance, and it wakes up a thread whenever there is a transaction ?

Reagrds
 
liao Yang
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The service() method is defined in a servlet class. There is only one instance of each servlet in each JVM. When there is a request to the servlet, the container get a thread from the thread pool or create a mew thread for this request and call the service() method of the requested servlet. So the service() method may run parallelly in more than threads.

Hope this helps.
 
Mamadou Touré
Ranch Hand
Posts: 189
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it the servlet who runs the service() method or the container ?
 
Deepak Jain
Ranch Hand
Posts: 637
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Container invokes service() for client request in a new thread.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic