This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
This question is taken from JWebPlus and I am a little confused by one of the answers. "Assuming that the Servlet Container has just called the destroy() mthod of a servlet instance, which of the following statements are correct"? Answer: The servlet container time out has exceeded for this servlet instance. Is the destroy() method only called when the session has timed out or has been invalidated using invalidate()? I thought the container could remove the instance of a servlet to converse memory and thus the destory() method would be called in this case as well. Help!
Sun Certified J2EE Architect for the J2EE Platform (Part 1)<br />Sun Certified Web Component Developer for the J2EE Platform<br />Sun Certified Programmer for the Java 2 Platform
That's not what it says -- it's not referring to session timeouts. I would agree that the wording is confusing. The servlet lifecycle has absolutely nothing to do with the session lifecycle. The servlet container calls destroy() when it wants to remove the servlet to conserve memory (or because the server shuts down). Typically, a container will do this if a servlet has not been accessed for a while; this is the "timeout" the answer refers to. But this is an implementation detail of the container and not part of the spec, so really I think the answer should be reworded. - Peter
Joined: Jan 23, 2002
Ah! That totally makes sense Peter. I guess it all came down to what "timeout" they were talking about. Thanks.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com