Class DefaultAsyncJobExecutor

java.lang.Object
org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor
All Implemented Interfaces:
AsyncExecutor
Direct Known Subclasses:
ManagedAsyncJobExecutor, SharedExecutorServiceAsyncExecutor

public class DefaultAsyncJobExecutor extends Object implements AsyncExecutor
  • Field Details

    • corePoolSize

      protected int corePoolSize
      The minimal number of threads that are kept alive in the threadpool for job execution
    • maxPoolSize

      protected int maxPoolSize
      The maximum number of threads that are kept alive in the threadpool for job execution
    • keepAliveTime

      protected long keepAliveTime
      The time (in milliseconds) a thread used for job execution must be kept alive before it is destroyed. Default setting is 0. Having a non-default setting of 0 takes resources, but in the case of many job executions it avoids creating new threads all the time.
    • queueSize

      protected int queueSize
      The size of the queue on which jobs to be executed are placed
    • threadPoolQueue

      protected BlockingQueue<Runnable> threadPoolQueue
      The queue used for job execution work
    • executorService

      protected ExecutorService executorService
      The executor service used for job execution
    • secondsToWaitOnShutdown

      protected long secondsToWaitOnShutdown
      The time (in seconds) that is waited to gracefully shut down the threadpool used for job execution
    • timerJobAcquisitionThread

      protected Thread timerJobAcquisitionThread
    • asyncJobAcquisitionThread

      protected Thread asyncJobAcquisitionThread
    • resetExpiredJobThread

      protected Thread resetExpiredJobThread
    • timerJobRunnable

      protected AcquireTimerJobsRunnable timerJobRunnable
    • asyncJobsDueRunnable

      protected AcquireAsyncJobsDueRunnable asyncJobsDueRunnable
    • resetExpiredJobsRunnable

      protected ResetExpiredJobsRunnable resetExpiredJobsRunnable
    • executeAsyncRunnableFactory

      protected ExecuteAsyncRunnableFactory executeAsyncRunnableFactory
    • isAutoActivate

      protected boolean isAutoActivate
    • isActive

      protected boolean isActive
    • isMessageQueueMode

      protected boolean isMessageQueueMode
    • maxTimerJobsPerAcquisition

      protected int maxTimerJobsPerAcquisition
    • maxAsyncJobsDuePerAcquisition

      protected int maxAsyncJobsDuePerAcquisition
    • defaultTimerJobAcquireWaitTimeInMillis

      protected int defaultTimerJobAcquireWaitTimeInMillis
    • defaultAsyncJobAcquireWaitTimeInMillis

      protected int defaultAsyncJobAcquireWaitTimeInMillis
    • defaultQueueSizeFullWaitTime

      protected int defaultQueueSizeFullWaitTime
    • lockOwner

      protected String lockOwner
    • timerLockTimeInMillis

      protected int timerLockTimeInMillis
    • asyncJobLockTimeInMillis

      protected int asyncJobLockTimeInMillis
    • retryWaitTimeInMillis

      protected int retryWaitTimeInMillis
    • resetExpiredJobsInterval

      protected int resetExpiredJobsInterval
    • resetExpiredJobsPageSize

      protected int resetExpiredJobsPageSize
    • temporaryJobQueue

      protected LinkedList<Job> temporaryJobQueue
    • processEngineConfiguration

      protected ProcessEngineConfigurationImpl processEngineConfiguration
  • Constructor Details

    • DefaultAsyncJobExecutor

      public DefaultAsyncJobExecutor()
  • Method Details

    • executeAsyncJob

      public boolean executeAsyncJob(Job job)
      Description copied from interface: AsyncExecutor
      Offers the provided JobEntity to this AsyncExecutor instance to execute. If the offering does not work for some reason, false will be returned (For example when the job queue is full in the DefaultAsyncJobExecutor).
      Specified by:
      executeAsyncJob in interface AsyncExecutor
    • createRunnableForJob

      protected Runnable createRunnableForJob(Job job)
    • start

      public void start()
      Starts the async executor
      Specified by:
      start in interface AsyncExecutor
    • executeTemporaryJobs

      protected void executeTemporaryJobs()
    • shutdown

      public void shutdown()
      Shuts down the whole job executor
      Specified by:
      shutdown in interface AsyncExecutor
    • initAsyncJobExecutionThreadPool

      protected void initAsyncJobExecutionThreadPool()
    • stopExecutingAsyncJobs

      protected void stopExecutingAsyncJobs()
    • startJobAcquisitionThread

      protected void startJobAcquisitionThread()
      Starts the acquisition thread
    • startTimerAcquisitionThread

      protected void startTimerAcquisitionThread()
    • stopJobAcquisitionThread

      protected void stopJobAcquisitionThread()
      Stops the acquisition thread
    • stopTimerAcquisitionThread

      protected void stopTimerAcquisitionThread()
    • startResetExpiredJobsThread

      protected void startResetExpiredJobsThread()
      Starts the reset expired jobs thread
    • stopResetExpiredJobsThread

      protected void stopResetExpiredJobsThread()
      Stops the reset expired jobs thread
    • applyConfig

      public void applyConfig(ProcessEngineConfigurationImpl processEngineConfiguration)
    • getProcessEngineConfiguration

      public ProcessEngineConfigurationImpl getProcessEngineConfiguration()
      Specified by:
      getProcessEngineConfiguration in interface AsyncExecutor
    • setProcessEngineConfiguration

      public void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration)
      Specified by:
      setProcessEngineConfiguration in interface AsyncExecutor
    • getTimerJobAcquisitionThread

      public Thread getTimerJobAcquisitionThread()
    • setTimerJobAcquisitionThread

      public void setTimerJobAcquisitionThread(Thread timerJobAcquisitionThread)
    • getAsyncJobAcquisitionThread

      public Thread getAsyncJobAcquisitionThread()
    • setAsyncJobAcquisitionThread

      public void setAsyncJobAcquisitionThread(Thread asyncJobAcquisitionThread)
    • getResetExpiredJobThread

      public Thread getResetExpiredJobThread()
    • setResetExpiredJobThread

      public void setResetExpiredJobThread(Thread resetExpiredJobThread)
    • isAutoActivate

      public boolean isAutoActivate()
      Specified by:
      isAutoActivate in interface AsyncExecutor
    • setAutoActivate

      public void setAutoActivate(boolean isAutoActivate)
      Specified by:
      setAutoActivate in interface AsyncExecutor
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface AsyncExecutor
    • isMessageQueueMode

      public boolean isMessageQueueMode()
    • setMessageQueueMode

      public void setMessageQueueMode(boolean isMessageQueueMode)
    • getQueueSize

      public int getQueueSize()
    • setQueueSize

      public void setQueueSize(int queueSize)
    • getCorePoolSize

      public int getCorePoolSize()
    • setCorePoolSize

      public void setCorePoolSize(int corePoolSize)
    • getMaxPoolSize

      public int getMaxPoolSize()
    • setMaxPoolSize

      public void setMaxPoolSize(int maxPoolSize)
    • getKeepAliveTime

      public long getKeepAliveTime()
    • setKeepAliveTime

      public void setKeepAliveTime(long keepAliveTime)
    • getSecondsToWaitOnShutdown

      public long getSecondsToWaitOnShutdown()
    • setSecondsToWaitOnShutdown

      public void setSecondsToWaitOnShutdown(long secondsToWaitOnShutdown)
    • getThreadPoolQueue

      public BlockingQueue<Runnable> getThreadPoolQueue()
    • setThreadPoolQueue

      public void setThreadPoolQueue(BlockingQueue<Runnable> threadPoolQueue)
    • getExecutorService

      public ExecutorService getExecutorService()
    • setExecutorService

      public void setExecutorService(ExecutorService executorService)
    • getLockOwner

      public String getLockOwner()
      Specified by:
      getLockOwner in interface AsyncExecutor
    • setLockOwner

      public void setLockOwner(String lockOwner)
    • getTimerLockTimeInMillis

      public int getTimerLockTimeInMillis()
      Specified by:
      getTimerLockTimeInMillis in interface AsyncExecutor
    • setTimerLockTimeInMillis

      public void setTimerLockTimeInMillis(int timerLockTimeInMillis)
      Specified by:
      setTimerLockTimeInMillis in interface AsyncExecutor
    • getAsyncJobLockTimeInMillis

      public int getAsyncJobLockTimeInMillis()
      Specified by:
      getAsyncJobLockTimeInMillis in interface AsyncExecutor
    • setAsyncJobLockTimeInMillis

      public void setAsyncJobLockTimeInMillis(int asyncJobLockTimeInMillis)
      Specified by:
      setAsyncJobLockTimeInMillis in interface AsyncExecutor
    • getMaxTimerJobsPerAcquisition

      public int getMaxTimerJobsPerAcquisition()
      Specified by:
      getMaxTimerJobsPerAcquisition in interface AsyncExecutor
    • setMaxTimerJobsPerAcquisition

      public void setMaxTimerJobsPerAcquisition(int maxTimerJobsPerAcquisition)
      Specified by:
      setMaxTimerJobsPerAcquisition in interface AsyncExecutor
    • getMaxAsyncJobsDuePerAcquisition

      public int getMaxAsyncJobsDuePerAcquisition()
      Specified by:
      getMaxAsyncJobsDuePerAcquisition in interface AsyncExecutor
    • setMaxAsyncJobsDuePerAcquisition

      public void setMaxAsyncJobsDuePerAcquisition(int maxAsyncJobsDuePerAcquisition)
      Specified by:
      setMaxAsyncJobsDuePerAcquisition in interface AsyncExecutor
    • getDefaultTimerJobAcquireWaitTimeInMillis

      public int getDefaultTimerJobAcquireWaitTimeInMillis()
      Specified by:
      getDefaultTimerJobAcquireWaitTimeInMillis in interface AsyncExecutor
    • setDefaultTimerJobAcquireWaitTimeInMillis

      public void setDefaultTimerJobAcquireWaitTimeInMillis(int defaultTimerJobAcquireWaitTimeInMillis)
      Specified by:
      setDefaultTimerJobAcquireWaitTimeInMillis in interface AsyncExecutor
    • getDefaultAsyncJobAcquireWaitTimeInMillis

      public int getDefaultAsyncJobAcquireWaitTimeInMillis()
      Specified by:
      getDefaultAsyncJobAcquireWaitTimeInMillis in interface AsyncExecutor
    • setDefaultAsyncJobAcquireWaitTimeInMillis

      public void setDefaultAsyncJobAcquireWaitTimeInMillis(int defaultAsyncJobAcquireWaitTimeInMillis)
      Specified by:
      setDefaultAsyncJobAcquireWaitTimeInMillis in interface AsyncExecutor
    • setTimerJobRunnable

      public void setTimerJobRunnable(AcquireTimerJobsRunnable timerJobRunnable)
    • getDefaultQueueSizeFullWaitTimeInMillis

      public int getDefaultQueueSizeFullWaitTimeInMillis()
      Specified by:
      getDefaultQueueSizeFullWaitTimeInMillis in interface AsyncExecutor
    • setDefaultQueueSizeFullWaitTimeInMillis

      public void setDefaultQueueSizeFullWaitTimeInMillis(int defaultQueueSizeFullWaitTime)
      Specified by:
      setDefaultQueueSizeFullWaitTimeInMillis in interface AsyncExecutor
    • setAsyncJobsDueRunnable

      public void setAsyncJobsDueRunnable(AcquireAsyncJobsDueRunnable asyncJobsDueRunnable)
    • setResetExpiredJobsRunnable

      public void setResetExpiredJobsRunnable(ResetExpiredJobsRunnable resetExpiredJobsRunnable)
    • getRetryWaitTimeInMillis

      public int getRetryWaitTimeInMillis()
      Specified by:
      getRetryWaitTimeInMillis in interface AsyncExecutor
    • setRetryWaitTimeInMillis

      public void setRetryWaitTimeInMillis(int retryWaitTimeInMillis)
      Specified by:
      setRetryWaitTimeInMillis in interface AsyncExecutor
    • getResetExpiredJobsInterval

      public int getResetExpiredJobsInterval()
      Specified by:
      getResetExpiredJobsInterval in interface AsyncExecutor
    • setResetExpiredJobsInterval

      public void setResetExpiredJobsInterval(int resetExpiredJobsInterval)
      Specified by:
      setResetExpiredJobsInterval in interface AsyncExecutor
    • getResetExpiredJobsPageSize

      public int getResetExpiredJobsPageSize()
      Specified by:
      getResetExpiredJobsPageSize in interface AsyncExecutor
    • setResetExpiredJobsPageSize

      public void setResetExpiredJobsPageSize(int resetExpiredJobsPageSize)
      Specified by:
      setResetExpiredJobsPageSize in interface AsyncExecutor
    • getExecuteAsyncRunnableFactory

      public ExecuteAsyncRunnableFactory getExecuteAsyncRunnableFactory()
    • setExecuteAsyncRunnableFactory

      public void setExecuteAsyncRunnableFactory(ExecuteAsyncRunnableFactory executeAsyncRunnableFactory)