Package org.activiti.spring
Class SpringAsyncExecutor
java.lang.Object
org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor
org.activiti.spring.SpringAsyncExecutor
- All Implemented Interfaces:
org.activiti.engine.impl.asyncexecutor.AsyncExecutor
public class SpringAsyncExecutor
extends org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor
This is a spring based implementation of the Job Executor using spring abstraction TaskExecutor for performing background task execution.
The idea behind this implementation is to externalize the configuration of the task executor, so it can leverage to Application servers controller thread pools, for example using the commonj API. The use of unmanaged thread in application servers is discouraged by the Java EE spec.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SpringRejectedJobsHandlerprotected org.springframework.core.task.TaskExecutorFields inherited from class org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor
asyncJobAcquisitionThread, asyncJobLockTimeInMillis, asyncJobsDueRunnable, corePoolSize, defaultAsyncJobAcquireWaitTimeInMillis, defaultQueueSizeFullWaitTime, defaultTimerJobAcquireWaitTimeInMillis, executeAsyncRunnableFactory, executorService, isActive, isAutoActivate, isMessageQueueMode, keepAliveTime, lockOwner, maxAsyncJobsDuePerAcquisition, maxPoolSize, maxTimerJobsPerAcquisition, processEngineConfiguration, queueSize, resetExpiredJobsInterval, resetExpiredJobsPageSize, resetExpiredJobsRunnable, resetExpiredJobThread, retryWaitTimeInMillis, secondsToWaitOnShutdown, temporaryJobQueue, threadPoolQueue, timerJobAcquisitionThread, timerJobRunnable, timerLockTimeInMillis -
Constructor Summary
ConstructorsConstructorDescriptionSpringAsyncExecutor(org.springframework.core.task.TaskExecutor taskExecutor, SpringRejectedJobsHandler rejectedJobsHandler) -
Method Summary
Modifier and TypeMethodDescriptionbooleanexecuteAsyncJob(org.activiti.engine.runtime.Job job) org.springframework.core.task.TaskExecutorprotected voidvoidsetRejectedJobsHandler(SpringRejectedJobsHandler rejectedJobsHandler) Required spring injectedSpringRejectedJobsHandlerimplementation that will be used when jobs were rejected by the task executor.voidsetTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor) Required spring injectedTaskExecutorimplementation that will be used to execute runnable jobs.Methods inherited from class org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor
applyConfig, createRunnableForJob, executeTemporaryJobs, getAsyncJobAcquisitionThread, getAsyncJobLockTimeInMillis, getCorePoolSize, getDefaultAsyncJobAcquireWaitTimeInMillis, getDefaultQueueSizeFullWaitTimeInMillis, getDefaultTimerJobAcquireWaitTimeInMillis, getExecuteAsyncRunnableFactory, getExecutorService, getKeepAliveTime, getLockOwner, getMaxAsyncJobsDuePerAcquisition, getMaxPoolSize, getMaxTimerJobsPerAcquisition, getProcessEngineConfiguration, getQueueSize, getResetExpiredJobsInterval, getResetExpiredJobsPageSize, getResetExpiredJobThread, getRetryWaitTimeInMillis, getSecondsToWaitOnShutdown, getThreadPoolQueue, getTimerJobAcquisitionThread, getTimerLockTimeInMillis, isActive, isAutoActivate, isMessageQueueMode, setAsyncJobAcquisitionThread, setAsyncJobLockTimeInMillis, setAsyncJobsDueRunnable, setAutoActivate, setCorePoolSize, setDefaultAsyncJobAcquireWaitTimeInMillis, setDefaultQueueSizeFullWaitTimeInMillis, setDefaultTimerJobAcquireWaitTimeInMillis, setExecuteAsyncRunnableFactory, setExecutorService, setKeepAliveTime, setLockOwner, setMaxAsyncJobsDuePerAcquisition, setMaxPoolSize, setMaxTimerJobsPerAcquisition, setMessageQueueMode, setProcessEngineConfiguration, setQueueSize, setResetExpiredJobsInterval, setResetExpiredJobsPageSize, setResetExpiredJobsRunnable, setResetExpiredJobThread, setRetryWaitTimeInMillis, setSecondsToWaitOnShutdown, setThreadPoolQueue, setTimerJobAcquisitionThread, setTimerJobRunnable, setTimerLockTimeInMillis, shutdown, start, startJobAcquisitionThread, startResetExpiredJobsThread, startTimerAcquisitionThread, stopExecutingAsyncJobs, stopJobAcquisitionThread, stopResetExpiredJobsThread, stopTimerAcquisitionThread
-
Field Details
-
taskExecutor
protected org.springframework.core.task.TaskExecutor taskExecutor -
rejectedJobsHandler
-
-
Constructor Details
-
SpringAsyncExecutor
public SpringAsyncExecutor() -
SpringAsyncExecutor
public SpringAsyncExecutor(org.springframework.core.task.TaskExecutor taskExecutor, SpringRejectedJobsHandler rejectedJobsHandler)
-
-
Method Details
-
getTaskExecutor
public org.springframework.core.task.TaskExecutor getTaskExecutor() -
setTaskExecutor
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor) Required spring injectedTaskExecutorimplementation that will be used to execute runnable jobs.- Parameters:
taskExecutor-
-
getRejectedJobsHandler
-
setRejectedJobsHandler
Required spring injectedSpringRejectedJobsHandlerimplementation that will be used when jobs were rejected by the task executor.- Parameters:
rejectedJobsHandler-
-
executeAsyncJob
public boolean executeAsyncJob(org.activiti.engine.runtime.Job job) - Specified by:
executeAsyncJobin interfaceorg.activiti.engine.impl.asyncexecutor.AsyncExecutor- Overrides:
executeAsyncJobin classorg.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor
-
initAsyncJobExecutionThreadPool
protected void initAsyncJobExecutionThreadPool()- Overrides:
initAsyncJobExecutionThreadPoolin classorg.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor
-