If no object holds a reference to the Singleton object, then the Singleton class may disappear, later to be reloaded when the Singleton is again needed. In that case, a new Singleton object will be created. Any static or instance fields saved for the object will be lost and reinitialized.
I just want to make sure that the VM in which I run my singleton class, should not call garbage collection, so that I can have its instance existing irrespective of its usage. Is it possible to set some command on my VM so that this VM should not call gc?
A Singleton requires a static field to hold its optional single reference, so that it can be given when the instance is requested again. The existence of a static field holding a reference to it prevents the garbage collector from reclaiming it.
<a href="http://www.infoQuanta.com" target="_blank" rel="nofollow">infoQuanta</a> - parallel java programming made simple
This passage is very dated. Classes are actually never unloaded unless the ClassLoader that loaded them is itself garbage collected. Basically this means that any time there's a single instance of a single class in the JVM that could name the singleton class by name and get a reference to it, the class won't be unloaded. This really means that any time you could possibly, conceivably care, it will never happen.