wood burning stoves*
The moose likes Servlets and the fly likes service() method - interesting question ???? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "service() method - interesting question ????" Watch "service() method - interesting question ????" New topic
Author

service() method - interesting question ????

vithal kambhammettu
Greenhorn

Joined: Jul 18, 2001
Posts: 17
While in the service() method of a servlet, a secondary thread is spawned to write a long, I/O intensive, log file . If the service() method ends before the secondary thread what would happen now ???
1) The secondary thread ends when the service() method ends
2) The log file is closed when the service() method ends.
3) The service() method will wait until the secondary thread completes executing
4) The service() method ends but the secondary thread continues until it finishes
regards
Dave Van Even
Ranch Hand

Joined: Jul 19, 2001
Posts: 101
the when the secondary method is spawned and started it keeps running till someone tells it to end !
SO, It's depending on the implementation of your service() method. I you never end the secondary thread, it will keep running.
correct me if I'm wrong...
Dave Van Even
Thomas Samimuthu
Greenhorn

Joined: Aug 07, 2001
Posts: 8
Actualy any thread will exit when the run() method exits , so it is the programmers responsiblity to design the thread properly.
------------------
Valan


Thomas
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: service() method - interesting question ????
 
Similar Threads
Socket, Thread and synchronized
Threading Question
interesting question on service() method of servlet
confusion about object lock.
working of join() methord in Thread