File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Singleton vs application context

 
shaju joseph
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Justin Chu
Ranch Hand
Posts: 209
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic