I had a kind of similar question - posted here a couple of weeks back. Dint get any helpful replies though. Sorry if I sound silly or stupid, but why is it worong to have a infinite loop running somewhere in a web application? In my case, I need to have a thread that polls a log file every, say, 5 seconds. I am not in favour of having a Servlet do this task - would assign it to a ContextListener rather.