Search in sources :

Example 6 with ExecutorService

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;
}
Also used : AvailableJobsExecutor(org.jbpm.executor.impl.AvailableJobsExecutor) ClassCacheManager(org.jbpm.executor.impl.ClassCacheManager) AvailableJobsExecutor(org.jbpm.executor.impl.AvailableJobsExecutor) Executor(org.kie.api.executor.Executor) ExecutorAdminService(org.kie.api.executor.ExecutorAdminService) ExecutorRequestAdminServiceImpl(org.jbpm.executor.impl.jpa.ExecutorRequestAdminServiceImpl) ExecutorServiceImpl(org.jbpm.executor.impl.ExecutorServiceImpl) ExecutorStoreService(org.kie.api.executor.ExecutorStoreService) JPAExecutorStoreService(org.jbpm.executor.impl.jpa.JPAExecutorStoreService) ExecutorImpl(org.jbpm.executor.impl.ExecutorImpl) JPAExecutorStoreService(org.jbpm.executor.impl.jpa.JPAExecutorStoreService) ExecutorService(org.kie.api.executor.ExecutorService) ExecutorQueryServiceImpl(org.jbpm.executor.impl.jpa.ExecutorQueryServiceImpl) ExecutorQueryService(org.kie.api.executor.ExecutorQueryService)

Aggregations

ExecutorService (org.kie.api.executor.ExecutorService)6 HashMap (java.util.HashMap)2 ExecutorServiceImpl (org.jbpm.executor.impl.ExecutorServiceImpl)2 AsyncWorkItemHandler (org.jbpm.executor.impl.wih.AsyncWorkItemHandler)2 AsyncSignalEventCommand (org.jbpm.process.core.async.AsyncSignalEventCommand)2 CommandContext (org.kie.api.executor.CommandContext)2 RuntimeManager (org.kie.api.runtime.manager.RuntimeManager)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 AsynchronousJobEvent (org.jbpm.executor.AsynchronousJobEvent)1 RequeueAware (org.jbpm.executor.RequeueAware)1 AvailableJobsExecutor (org.jbpm.executor.impl.AvailableJobsExecutor)1 ClassCacheManager (org.jbpm.executor.impl.ClassCacheManager)1 ExecutorImpl (org.jbpm.executor.impl.ExecutorImpl)1 ExecutorQueryServiceImpl (org.jbpm.executor.impl.jpa.ExecutorQueryServiceImpl)1 ExecutorRequestAdminServiceImpl (org.jbpm.executor.impl.jpa.ExecutorRequestAdminServiceImpl)1 JPAExecutorStoreService (org.jbpm.executor.impl.jpa.JPAExecutorStoreService)1 CountDownAsyncJobListener (org.jbpm.executor.test.CountDownAsyncJobListener)1 ProcessPersistenceContext (org.jbpm.persistence.api.ProcessPersistenceContext)1 ProcessPersistenceContextManager (org.jbpm.persistence.api.ProcessPersistenceContextManager)1