Class 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

      Fields 
      Modifier and Type Field Description
      protected SpringRejectedJobsHandler rejectedJobsHandler  
      protected org.springframework.core.task.TaskExecutor taskExecutor  
      • Fields 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean executeAsyncJob​(org.activiti.engine.runtime.Job job)  
      SpringRejectedJobsHandler getRejectedJobsHandler()  
      org.springframework.core.task.TaskExecutor getTaskExecutor()  
      protected void initAsyncJobExecutionThreadPool()  
      void setRejectedJobsHandler​(SpringRejectedJobsHandler rejectedJobsHandler)
      Required spring injected SpringRejectedJobsHandler implementation that will be used when jobs were rejected by the task executor.
      void setTaskExecutor​(org.springframework.core.task.TaskExecutor taskExecutor)
      Required spring injected TaskExecutor implementation 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • taskExecutor

        protected org.springframework.core.task.TaskExecutor taskExecutor
    • Constructor Detail

      • SpringAsyncExecutor

        public SpringAsyncExecutor()
      • SpringAsyncExecutor

        public SpringAsyncExecutor​(org.springframework.core.task.TaskExecutor taskExecutor,
                                   SpringRejectedJobsHandler rejectedJobsHandler)
    • Method Detail

      • getTaskExecutor

        public org.springframework.core.task.TaskExecutor getTaskExecutor()
      • setTaskExecutor

        public void setTaskExecutor​(org.springframework.core.task.TaskExecutor taskExecutor)
        Required spring injected TaskExecutor implementation that will be used to execute runnable jobs.
        Parameters:
        taskExecutor -
      • setRejectedJobsHandler

        public void setRejectedJobsHandler​(SpringRejectedJobsHandler rejectedJobsHandler)
        Required spring injected SpringRejectedJobsHandler implementation 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:
        executeAsyncJob in interface org.activiti.engine.impl.asyncexecutor.AsyncExecutor
        Overrides:
        executeAsyncJob in class org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor
      • initAsyncJobExecutionThreadPool

        protected void initAsyncJobExecutionThreadPool()
        Overrides:
        initAsyncJobExecutionThreadPool in class org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor