Is this something you can configure and/or dependent on your Application Server? I am wondering if a singleton object will be reconstructed when you re-deploy the application.
I would rather ask here and try and get a concise answer than googling randomly or resorting to reading J2EE Servlet Specs –
No, it will not (at least no app server that I know of). The servlet specification gives you the ServletContextListener hook to manage app lifecycle. Some app servers like JBoss have special annotations for singleton beans (@Service), and EJB 3.1 gives you the @Singleton annotation. One other thing to think about when using singletons is what will happen when you cluster you app, you will need High Availability (HA) or use some type of replication, unless you use a share nothing approach. Distributed caches are good for this reason.