AnsweredAssumed Answered

Java program won't terminate after ProcessEngines.destroy()

Question asked by louis44 on Jul 6, 2015
Latest reply on Jul 11, 2015 by louis44
I have a Java class I am running with a main method like this:

    public static void main(String[] args) {
        ProcessEngineConfiguration engineConfig =
                ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg-file-job.xml");
        ProcessEngine engine = engineConfig.buildProcessEngine();

        System.out.println("getting here");
        ProcessEngines.destroy();
        System.out.println("getting there");

       // will not terminate
    }

The activiti.cfg-file-job.xml looks like:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

  <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">
      <property name="jdbcUrl" value="jdbc:h2:file:activiti;DB_CLOSE_DELAY=1000" />
      <property name="jdbcDriver" value="org.h2.Driver" />
      <property name="jdbcUsername" value="sa" />
      <property name="jdbcPassword" value="" />

      <property name="databaseSchemaUpdate" value="true" />
      <!– use async executor –>
      <property name="jobExecutorActivate" value="false" />
      <property name="asyncExecutorEnabled" value="true" />
      <property name="asyncExecutorActivate" value="true" />

  </bean>
 
</beans>


My java program doesn't terminate. I assume this is because the job executor thread is still running. Is ProcessEngines.destroy() supposed to shut everything down or do I have to do that manually some other way?

Outcomes