Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Destroy

 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ranchers.

are'nt all the threads for a particular servlet done if the servlets destroy method is called. I got one of the questions in Jweb plus

Assuming that the Servlet Container has just called the destroy() method of a servlet instance, which of the following statements are correct?
& one of the option was

All threads created by this servlet are done.

Thanks
Shashank
 
cheenu Dev
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first know this:
when you call servlets destroy method its abrupt...
you dont tell to wait for any thread to be finished..
so any thread that runs currently dies..(abruptly) does not finish its work!!!
consider...

if(!toContinue)
destroy();------ threads may run upto here..
else()
......
out.print("hey"); -------- threads dont come here after destroy()..it means toContinue returned false so, they didnt finish. ya THEY DIDNT FINISH.

(this is just a snippet not full code)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic