use of org.activiti.engine.ProcessEngineLifecycleListener in project Activiti by Activiti.
the class AbstractActviti6Test method initializeH2WebApp.
protected void initializeH2WebApp(ProcessEngine processEngine) {
try {
final Server server = Server.createWebServer("-web");
// Shutdown hook
final ProcessEngineConfiguration processEngineConfiguration = ((ProcessEngineImpl) processEngine).getProcessEngineConfiguration();
final ProcessEngineLifecycleListener originalLifecycleListener = processEngineConfiguration.getProcessEngineLifecycleListener();
processEngineConfiguration.setProcessEngineLifecycleListener(new ProcessEngineLifecycleListener() {
@Override
public void onProcessEngineClosed(ProcessEngine processEngine) {
server.stop();
originalLifecycleListener.onProcessEngineClosed(processEngine);
}
@Override
public void onProcessEngineBuilt(ProcessEngine processEngine) {
originalLifecycleListener.onProcessEngineBuilt(processEngine);
}
});
// Actually start the web server
server.start();
} catch (SQLException e) {
logger.warn("Could not start H2 webapp", e);
}
}
Aggregations