static {
   if (beanFactory == null) {
     ProcessEngineImpl processEngine =
         (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
     beanFactory = (Map) processEngine.getProcessEngineConfiguration().getBeans();
   }
 }
Example #2
0
 public static void main(String[] args) throws Exception {
   // 创建流程引擎
   ProcessEngineImpl engine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
   // 启动JobExecutor
   engine.getProcessEngineConfiguration().getJobExecutor().start();
   // 得到流程存储服务组件
   RepositoryService repositoryService = engine.getRepositoryService();
   RuntimeService runtimeService = engine.getRuntimeService();
   // 部署流程文件
   repositoryService
       .createDeployment()
       .addClasspathResource("bpmn11.3/TimerStartEvent.bpmn")
       .deploy();
   // 一分钟后关闭JobExecutor
   Thread.sleep(1000 * 60);
   engine.getProcessEngineConfiguration().getJobExecutor().shutdown();
   // 查询流程实例
   List<ProcessInstance> ints = runtimeService.createProcessInstanceQuery().list();
   System.out.println(ints.size());
 }