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

    Fields
    Modifier and Type
    Field
    Description
     
    protected org.springframework.core.task.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
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    SpringAsyncExecutor(org.springframework.core.task.TaskExecutor taskExecutor, SpringRejectedJobsHandler rejectedJobsHandler)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    executeAsyncJob(org.activiti.engine.runtime.Job job)
     
     
    org.springframework.core.task.TaskExecutor
     
    protected void
     
    void
    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 Details

    • taskExecutor

      protected org.springframework.core.task.TaskExecutor taskExecutor
    • rejectedJobsHandler

      protected SpringRejectedJobsHandler 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 injected TaskExecutor implementation that will be used to execute runnable jobs.
      Parameters:
      taskExecutor -
    • getRejectedJobsHandler

      public SpringRejectedJobsHandler getRejectedJobsHandler()
    • 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