> From: jkv [mailto:j.kumara...@gmail.com] > Subject: Singletons in Tomcat(6.0) > > Is using singleton patterns in Tomcat (in servlets programming and > deploying them in tomcat) a really bad idea??
No, it's fine. > One really useful post is > http://wiki.apache.org/tomcat/OutOfMemory Unfortunately, the section on singletons in that page is completely bogus. Keeping an instance of a class in a static variable of that class does not inhibit garbage collection in any way in a current JVM. I suspect the author was using a GC method in an older JVM where class unloading was disabled, or he simply didn't wait long enough for the class to be discarded (calling System.gc() won't do it). The comment about starting extra threads is also erroneous. As long as your webapp manages the threads by using a ServletContextListener to shut them down when the webapp is stopped, there's no problem. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org