title: Background Thread for a Tomcat servlet app
body: <p>I am not very familiar with Tomcat, in my head it is basically abstracted as a cgi server that saves the JVM between calls -- I know it can do a lot more than that, though. </p>
  
  <p>I am looking for a way to launch a <em>background</em> thread when a Tomcat server starts, which would periodically update the Server Context (in my particular case this is a thread that listens to heartbeats from some other services and updates availability information, but one can imagine a variety of uses for this).  </p>
  
  <p>Is there a standard way to do this? Both the launching, and the updating/querying of the Context?</p>
  
  <p>Any pointers to the relevant documentation and/or code samples would be much appreciated.</p>