You might consider using the scheduler in JBoss to initiate the task - it avoids having to create a special thread encapsulation. Otherwise you would have to think about building an MBean to run your thread. The other possibility is to use Quartz which is along the same lines as the JBoss scheduler. YMMV.
Thank you so much Jon a bit more explanation with an example if you have would be highly beneficial for me please.
The old timer/scheduler tutorial is here - http://jboss.sourceforge.net/doc-24/ch11s58.html.
The starting point for MBeans is the Sun docs at http://docs.sun.com/db/doc/806-6633?q=mbeans
However, the JBoss source is littered with concrete MBean examples. You might consider looking at the pool branch of the source or even the timer/scheduler source as nicely separable and isolated examples.
The Quartz project is located here - http://www.quartzscheduler.org/index.jsp.
Hope that gets you a start.
Many Thanks Jon that does definitely help me to start with.
We are running JBoss 3.2.1, and we use the JMX Timer functionality to create our scheduled services.
We create an MBean that implements:
Then, in the jboss-service.xml file, we declare that MBean that is dependent on another MBean of type javax.management.timer.Timer. This Timer bean fires off notification that the first bean knows how to respond to.
Hop that helps