I'm trying to construct a servlet as a monitoring device for a set of remote computers. Basically the servlet pings the computers every few minutes and reports an error if a computer cannot be reached.
To accomplish this, I have created the servet with an init() method that contains an infinite while loop, set to sleep periodically. To start the servel, I have added a load-on-startup tag to the web.xml.
Problems: I've noticed when I reploy the application in Geronimo, the servlet fires during the deployment process and basically hangs the deployment. I tested this by making the loop terminate after a couple of minutes (instead of running forever), and as I expected, the deployment did not complete until the servlet finished.
Questions: Am supposed to be using doGet/doPost/service instead of init? Also, anyone have a better idea for a single threaded task in a J2EE environment than using a servlet with infinite loop?