I need to do something in the jboss server periodically.
I know user can't create thread in the j2ee server, then how can i do that?
I can run another process, which will notify a message-driven bean in jboss periodically, then the bean will do something.
is that the only solution?
-
backgroud thread (1 messages)
- Posted by: normal wang
- Posted on: October 08 2003 23:53 EDT
Threaded Messages (1)
- JMX? JBoss Scheduler? by Valery Silaev on October 09 2003 04:06 EDT
-
JMX? JBoss Scheduler?[ Go to top ]
- Posted by: Valery Silaev
- Posted on: October 09 2003 04:06 EDT
- in response to normal wang
Don't forget that JBoss is foremost a JMX container. So you can simply write an MBean that spawns (and manages) it's own background thread for performing actual task.
Personally, we use this background thread to post messages to JMS queue, so it's almost the same thing you are suggesting. However, I guess that it's better to have a managed entity (MBean) in managed environment (JMX) rather then stand-alone program.
Also, if your periodically tasks should be fired at fixed-rate intervals, do not reinvent the wheel at all -- JBoss has build-in Scheduler MBean. You can easily plug necessary code to fire JMS message by some kind of onTimer event. More details in paid doc (but, AFAIK, some info available in QuickStart as well).
Hopefully, the situation will change with J2EE 1.4 when we get (at last) Timer MDB.