This week's book giveaway is in the Performance forum. We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line! See this thread for details.
Hello, What's the difference between making a class singleton and setting a class variable in the application context ? If I make a class singleton , is it available till the server is shutdown ? Thanks
posted 14 years ago
Application context is actually just "WAR-context" whereas singleton context is JVM wide(If your JAR is put in server's class path). Stuffs being stored in ServletContext will be unloaded, and reloaded when you reload the WAR, or updates the WAR. Singletons in the JVM will not be reloaded until you shutdown the server.