-
1. Re: Trouble with jBPM 4 job executor and context reloading.
unsavory Mar 5, 2010 8:40 PM (in response to unsavory)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
-
2. Re: Trouble with jBPM 4 job executor and context reloading.
jelies Apr 20, 2010 8:35 AM (in response to unsavory)great solution, thanks for the link!