Is there a SIMPLE way to "know" when tomcat server is stopping?
I've written an MVC Controller application that is utilizing a self authored dB connection pooler class.
As part of establishing a new pool I instantiate a subclass "reaper" thread that tests that pool's individual dB connections on a scheduled basis, reaping any that have died or are not returning an expected response.
I have a finalize method in my ConnectionPool class which sets a "timeToStop" boolean field in the reaper thread so that after the end of the current "sleep interval" the thread knows it's time to exit it's loop:
My problem is that when the tomcat server stops, my ConnectionPool class's "finalize()" method is not being called.
#1) worth 250: Can anyone explain why my classes finalize() isn't being called when the Tomcat Server is stopping?
#2) worth 250: Can someone give me a SIMPLE (if at all possible: "static") field that I can monitor in my thead to know that the tomcat server is stopping? If not, is there another way to "know" when the tomcat server is stopping so that I can end my thread loop?