Write a servlet, this servlet contains a class that extends Thread.
Set to true using thread class setDaemon (boolean on)
Starting with Web Container and starts in Web.xml
Your servlet name servlet-name>
Your servlet class servlet-clas>
1 load-on-startup>
servlet>
The 1 representative of there started, if you have multiple servlets to start, the more the numbers are getting started before. . . .