public virtual void Close() { ProcessEngineFactory.Unregister(this); if (asyncExecutor != null && asyncExecutor.Active) { asyncExecutor.Shutdown(); } commandExecutor.Execute(processEngineConfiguration.SchemaCommandConfig, new SchemaOperationProcessEngineClose()); if (processEngineConfiguration.ProcessEngineLifecycleListener != null) { processEngineConfiguration.ProcessEngineLifecycleListener.OnProcessEngineClosed(this); } processEngineConfiguration.EventDispatcher.DispatchEvent(ActivitiEventBuilder.CreateGlobalEvent(ActivitiEventType.ENGINE_CLOSED)); }
public ProcessEngineImpl(ProcessEngineConfigurationImpl processEngineConfiguration) { this.processEngineConfiguration = processEngineConfiguration; this.name = processEngineConfiguration.ProcessEngineName; this.repositoryService = processEngineConfiguration.RepositoryService; this.runtimeService = processEngineConfiguration.RuntimeService; this.historicDataService = processEngineConfiguration.HistoryService; this.taskService = processEngineConfiguration.TaskService; this.managementService = processEngineConfiguration.ManagementService; this.dynamicBpmnService = processEngineConfiguration.DynamicBpmnService; this.asyncExecutor = processEngineConfiguration.AsyncExecutor; this.commandExecutor = processEngineConfiguration.CommandExecutor; this.sessionFactories = processEngineConfiguration.SessionFactories; this.transactionContextFactory = processEngineConfiguration.TransactionContextFactory; if (processEngineConfiguration.UsingRelationalDatabase && processEngineConfiguration.DatabaseSchemaUpdate is object) { commandExecutor.Execute(processEngineConfiguration.SchemaCommandConfig, new SchemaOperationsProcessEngineBuild()); } if (name is null) { log.LogInformation("default activiti ProcessEngine created"); } else { log.LogInformation($"ProcessEngine {name} created"); } ProcessEngineFactory.RegisterProcessEngine(this); if (asyncExecutor != null && asyncExecutor.AutoActivate) { asyncExecutor.Start(); } if (processEngineConfiguration.ProcessEngineLifecycleListener != null) { processEngineConfiguration.ProcessEngineLifecycleListener.OnProcessEngineBuilt(this); } processEngineConfiguration.EventDispatcher.DispatchEvent(ActivitiEventBuilder.CreateGlobalEvent(ActivitiEventType.ENGINE_CREATED)); }