-
1. Re: JBoss Shutdown and long-running MDB
adrian.brock Jan 27, 2006 12:22 PM (in response to pdoubleya)The current MDB implementation will wait for all "in flight" mdb requests to complete.
So if you don't have a mechanism to terminate prematurely, it will take as long as it takes.
There is no "kill immediately" option. -
2. Re: JBoss Shutdown and long-running MDB
pdoubleya Jan 27, 2006 12:28 PM (in response to pdoubleya)Adrian
Thanks much for the clarification. My question would be--what would be a clean way to listen for a shutdown process? Is there a reliable place to trap when a shutdown begins? If so I can implement my own semaphore or trigger to stop the MDB from continuing.
Thanks
Patrick -
3. Re: JBoss Shutdown and long-running MDB
adrian.brock Jan 27, 2006 12:34 PM (in response to pdoubleya)It depends upon what your MDB is doing.
If it is stuck inside a cpu loop then you would need something inside that loop
to check the "stop processing now flag" at regular intervals.
If it invokes on other EJBs, you can add an interceptor to check it
and even mark any transaction as rollback only. -
4. Re: JBoss Shutdown and long-running MDB
pdoubleya Jan 27, 2006 12:46 PM (in response to pdoubleya)Hi Adrian
I don't want to bother you with many details, but this particular MDB is processing a stream. The processing can take from a few seconds to several minutes. The timing is not so critical, and I can add a flag in the loop to see if it should abort.
My question is, at the moment either a shutdown is requested, or a redeploy begins, what process can I trap in JBoss? Is there some completely reliable action/event/step that I can monitor for? I can manage the flag myself, and bailing out of the loop, I just don't know how to tell when JBoss is trying to shutdown or redeploy the app. Shutdown is more important, in this case.
Many thanks
Patrick -
5. Re: JBoss Shutdown and long-running MDB
genman Jan 27, 2006 3:41 PM (in response to pdoubleya)
The thread *should* receive an Interrupt. Well, I don't know if that's what the spec actually requires, but you'll get InterruptedIOException if you're doing a blocking read. -
6. Re: JBoss Shutdown and long-running MDB
pdoubleya Jan 27, 2006 4:43 PM (in response to pdoubleya)Hi
Nope, no exceptions thrown, which is what surprised me. I'd figured that at the worst, JBoss would just pull the rug out from underneath the sucker. Hence my post here.
Regards
Patrick -
7. Re: JBoss Shutdown and long-running MDB
newbi Oct 25, 2006 4:41 AM (in response to pdoubleya)Hello,
I have the same problem, I need to implement a hook in the shutdown process to not wait for queues to process. Did you find a solution to your problem?
rgds,
newbi -
8. Re: JBoss Shutdown and long-running MDB
oglueck Jan 3, 2007 4:54 AM (in response to pdoubleya)In the loop you should check for Thread.interrupted() anyway. Plus you can register for a JMX notification about the shutdown. See http://docs.jboss.com/jbossas/javadoc/4.0.4/system/org/jboss/system/server/Server.html