There are many ways to do it.
1) Create a Startup servlet in your application and let it spawn a thread. this thread runs in an infinte loop waking up every 10 secs to output the log line
2) Create a MBean which gets started after your app is deployed. This class has a startService method(look up the Docs to know the Service lifecycle for mbeans) which spawns a thread that wakes up every 10 secs.
Thanks a lot for the help raja.
Are there any examples of either of the above, or documents that I can read. I'd read about MBeans but failed to find an example which I find the best way to get started.
I've managed to get a MBean running and talking to it via JMS- Thanks for the heads up.
I read that you shouldn't create threads within the J2EE Container but is that only for EJBs?
thats only for EJBs that live inside the container that is supposed to do all this resource management for you
MBeans in JBoss are more of a system level components, and you can freely have them do system level stuff, such as thread management.