-
1. Re: Using an MBean to spawn native Process with JBoss AS/4.0
dimitris Jun 21, 2006 3:39 AM (in response to keith1)1. Not stricly spec compliant (if talking about EJBs), but Ok
2. Don't know. If you can have a look, for the jboss web project, mladen made a wrapper library on top of apr (apache portable runtime) which may have better process control.
Let us know of your findings anyway. I'd be glad to incorporate a general purpose process handling mbean to jboss. -
2. Re: Using an MBean to spawn native Process with JBoss AS/4.0
keith1 Jun 22, 2006 7:39 AM (in response to keith1)Just as an update, I was able to find a solution to the problem. In order to spawn a native Process from an MBean required 3 threads and a signal handler. One thread handled the exec() and destroy() of the Process and implemented a signal handler to catch SIGTERM. The other two threads were typical stdout/stderr consumers to grab the output of the Process.
The key to the resolution was the introduction of a signal handler. I thought JBoss AS would object, but it seemed to work fine. I can either call Process.destroy() and kill the spawned process without affecting JBoss, or externally just "kill -9" the PID of the process without affecting JBoss. The signal handler for the thread which exec'd the Process catches the SIGTERM and my JBoss AS no longer exits with a sudden shutdown hook call.
Thanks for the feedback.
Regards,
Keith