[jboss-user] [jBPM] New message: "Re: Trouble with jBPM 4 job executor and context reloading."

Caine Lai do-not-reply at jboss.com
Fri Mar 5 20:41:01 EST 2010


User development,

A new message was posted in the thread "Trouble with jBPM 4 job executor and context reloading.":

http://community.jboss.org/message/530282#530282

Author  : Caine Lai
Profile : http://community.jboss.org/people/unsavory

Message:
--------------------------------------------------------------
In case this helps someone else, I found a solution to this problem.  By creating a Spring ApplicationListener that listens to the shutdown event, you can signal the jBPM job executor to shut down when the context is stopped.
 
/**
 * A Spring ApplicationListener that will properly shut down
 * the jBPM process engine when the Spring context is destroyed.
 * 
 * @author Caine
 * Created: Mar 5, 2010 - 4:30:58 PM
 */
@Component
@SuppressWarnings("unchecked")
public class SpringJbpmJobExecutorShutdownHook implements ApplicationListener {
    
    //~~ Static Fields/Initializers ==========================
    
    static final Logger log = Logger.getLogger(SpringJbpmJobExecutorShutdownHook.class);
    
    //~~ Dependencies ========================================
    
    @Resource
    ProcessEngine processEngine;
    
    //~~ Methods =============================================
    
    public void onApplicationEvent(ApplicationEvent event) {
        if (event instanceof ContextClosedEvent ) {
            log.info("Spring ApplicationContext shutting down.  Closing jBPM process engine.");
            processEngine.close();
            log.info("jBPM process engine closed.");
        }
    }
}
 
More details about the problem, and why it matters can be found on my blog post here:  http://captaincaveman.posterous.com/how-to-shut-down-the-jbpm-43-job-executor-wit

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/530282#530282




More information about the jboss-user mailing list