Re: Garbage collection of classes with static variable
On Wed, Apr 14, 2004 at 09:46:12PM +0100, Tiago Matias wrote: : As a side question, if the singleton life cycle can not be easily : controlled or known, what is the best way to perform an one-time : expensive initialization? If it's just general init activity (say, loading a config file), do a web search for "ContextListener" -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Garbage collection of classes with static variable
Hey I know that this is an old and a quite recurring issue here, but after spending some time going through the archives and googling around I'm still a bit confused. The problem is relatively simple. I have a singleton class which takes a lot of time to initialize and I need to understand if that class is eligible for GC and, if so, when could that happen. From what I've found, since java 1.2, a class may only be unloaded when it's class loader is reclaimed for GC. Is it possible for the class loader of a web application to be recycled for some reason (other than the web application being reloaded) ? As a side question, if the singleton life cycle can not be easily controlled or known, what is the best way to perform an one-time expensive initialization? Many thanks in advance Tiago Matias - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]