I have one global variable in servlet context, when application start up, I will read it from properties file, then it counts by itself, until the application is shut down, I have to save the current value back to properties file.
How can the code knows that the application is being shut down? Any good suggestion on this?
Please see ServletContextListener
http://docs.oracle.com/javaee/5/api/javax/servlet/ServletContextListener.html