Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Mock exam question

 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem:
Assuming that the Servlet Container has just called the destroy() method of a servlet instance, which of the following statements are correct?

Options:
1. Any resources that this servlet might hold have been released.
2. The servlet container time out has exceeded for this servlet instance.
3. The init() method has been called on this instance.
4. None of the requests can EVER be serviced by this instance.
5. All threads created by this servlet are done.

Answers Given: 3 & 4

How come the 3rd Option is right? will it call init() again?
(He didn't sayed anything like the new request come again in the question)
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The init() method has been called on this instance. And we all know init() method is always called once when the servlet is loaded.

So it is saying, it not called when destroy is called , but it has been called previously..

Regards

Prem Kashyap
 
Shashidhar Yarabati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for helping me to understand.

But it sound's like it just called again...
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
option 5 also seems correct "5. All threads created by this servlet are done."
Because unless all the threads are serviced destroy() cannot be called. Right?
Can someone please throw light on this concept?
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Option 5 also seems correct. Till all the threads spawned by this Servlet instance are not done, the destroy() should not be called as destroy is called only when removing the instance from memory.

Can someone please confirm?
 
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic