aspose file tools*
The moose likes Java in General and the fly likes Singleton instance lifecycle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Singleton instance lifecycle" Watch "Singleton instance lifecycle" New topic
Author

Singleton instance lifecycle

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9618
    
    2

Guys,

How is the lifecycle of a POJO Singleton instance managed in an app / web server. I have a Singleton class and this will be accessed by some components which are under the control of an app server. Now upon first request for this Singleton instance, the ClassLoader will load the class in memory, create an instance and is this instance retained in the memory untill the app server is brought down?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19781
    
  20

Until the class is unloaded, which usually indeed is when the app server (or JVM for standalone apps) is shut down.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Monu Tripathi
Rancher

Joined: Oct 12, 2008
Posts: 1369
    
    1

Even I asked this question once!


[List of FAQs] | [Android FAQ] | [Samuh Varta]
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9618
    
    2

Thanks for the information.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Singleton instance lifecycle