Package org.bonitasoft.engine.work
Class DefaultBonitaExecutorServiceFactory
- java.lang.Object
-
- org.bonitasoft.engine.work.DefaultBonitaExecutorServiceFactory
-
- All Implemented Interfaces:
BonitaExecutorServiceFactory
@Component("bonitaExecutorServiceFactory") public class DefaultBonitaExecutorServiceFactory extends java.lang.Object implements BonitaExecutorServiceFactoryUse ThreadPoolExecutor as ExecutorService The handling of threads relies on the JVM The rules to create new thread are: - If the number of threads is less than the corePoolSize, create a new Thread to run a new task. - If the number of threads is equal (or greater than) the corePoolSize, put the task into the queue. - If the queue is full, and the number of threads is less than the maxPoolSize, create a new thread to run tasks in. - If the queue is full, and the number of threads is greater than or equal to maxPoolSize, reject the task. When the current number of threads are > than corePoolSize, they are kept idle during keepAliveTimeSeconds- Author:
- Baptiste Mesta
-
-
Constructor Summary
Constructors Constructor Description DefaultBonitaExecutorServiceFactory(WorkFactory workFactory, long tenantId, int corePoolSize, int queueCapacity, int maximumPoolSize, long keepAliveTimeSeconds, EngineClock engineClock, WorkExecutionAuditor workExecutionAuditor, io.micrometer.core.instrument.MeterRegistry meterRegistry, ExecutorServiceMetricsProvider executorServiceMetricsProvider)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BonitaExecutorServicecreateExecutorService(WorkExecutionCallback workExecutionCallback)Create a bonita executor service with the givenWorkExecutionCallbackvoidunbind()
-
-
-
Constructor Detail
-
DefaultBonitaExecutorServiceFactory
public DefaultBonitaExecutorServiceFactory(WorkFactory workFactory, @Value("${tenantId}") long tenantId, @Value("${bonita.tenant.work.corePoolSize}") int corePoolSize, @Value("${bonita.tenant.work.queueCapacity}") int queueCapacity, @Value("${bonita.tenant.work.maximumPoolSize}") int maximumPoolSize, @Value("${bonita.tenant.work.keepAliveTimeSeconds}") long keepAliveTimeSeconds, EngineClock engineClock, WorkExecutionAuditor workExecutionAuditor, io.micrometer.core.instrument.MeterRegistry meterRegistry, ExecutorServiceMetricsProvider executorServiceMetricsProvider)
-
-
Method Detail
-
createExecutorService
public BonitaExecutorService createExecutorService(WorkExecutionCallback workExecutionCallback)
Description copied from interface:BonitaExecutorServiceFactoryCreate a bonita executor service with the givenWorkExecutionCallback- Specified by:
createExecutorServicein interfaceBonitaExecutorServiceFactory- Parameters:
workExecutionCallback- this callback will be executed when a work complete.- Returns:
- the
BonitaExecutorService
-
unbind
public void unbind()
- Specified by:
unbindin interfaceBonitaExecutorServiceFactory
-
-