use of org.kie.api.executor.ExecutorService in project jbpm by kiegroup.
the class ExecutorServiceFactory method configure.
private static ExecutorService configure(EntityManagerFactory emf, TransactionalCommandService commandService, ExecutorEventSupportImpl eventSupport) {
// create instances of executor services
ExecutorQueryService queryService = new ExecutorQueryServiceImpl(true);
Executor executor = new ExecutorImpl();
ExecutorAdminService adminService = new ExecutorRequestAdminServiceImpl();
ExecutorStoreService storeService = new JPAExecutorStoreService(true);
((JPAExecutorStoreService) storeService).setCommandService(commandService);
((JPAExecutorStoreService) storeService).setEmf(emf);
((JPAExecutorStoreService) storeService).setEventSupport(eventSupport);
AvailableJobsExecutor jobExecutor = new AvailableJobsExecutor();
ClassCacheManager classCacheManager = new ClassCacheManager();
jobExecutor.setClassCacheManager(classCacheManager);
jobExecutor.setQueryService(queryService);
jobExecutor.setExecutorStoreService(storeService);
jobExecutor.setEventSupport(eventSupport);
jobExecutor.setExecutor(executor);
((ExecutorImpl) executor).setExecutorStoreService(storeService);
((ExecutorImpl) executor).setEventSupport(eventSupport);
((ExecutorImpl) executor).setJobProcessor(jobExecutor);
((ExecutorImpl) executor).setTransactionManager(commandService.getTransactionManager());
// set executor on all instances that requires it
((ExecutorQueryServiceImpl) queryService).setCommandService(commandService);
((ExecutorRequestAdminServiceImpl) adminService).setCommandService(commandService);
((ExecutorRequestAdminServiceImpl) adminService).setExecutor(executor);
// configure services
ExecutorService service = new ExecutorServiceImpl(executor);
((ExecutorServiceImpl) service).setQueryService(queryService);
((ExecutorServiceImpl) service).setExecutor(executor);
((ExecutorServiceImpl) service).setAdminService(adminService);
((ExecutorServiceImpl) service).setEventSupport(eventSupport);
return service;
}
Aggregations