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.
It is up to the container to handle creation and initiation of a servlet instance - the servlet contract says that this will all happen before the first request is handed to the servlet instance.
The following statement:
so if more entities call the instantiation method all gets the same object?
is meaningless because there is only one entity - the container - that will ever call the "instatiation" method and it only does it once.
Joined: Feb 16, 2013
Hi William thanks for your time,
that sentence is deceptive. what I means is if there were more servlet/filter/listener using the same singleton...
anyway the loading of the Singleton class happens at the first call in whatever servlet/filter/listener call it.
the unloading of the Singleton class happens at container reloading, and it is becouse the servlet/filter/listener uses it and remains in vm memory until the container restart?
So different thread always refers to the same singleton instance. Could you confirm?