public class SpringAsyncExecutor extends DefaultAsyncJobExecutor
This is a spring based implementation of the JobExecutor
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.
Modifier and Type | Field and Description |
---|---|
protected SpringRejectedJobsHandler |
rejectedJobsHandler |
protected org.springframework.core.task.TaskExecutor |
taskExecutor |
corePoolSize, executorService, maxPoolSize, queueSize, secondsToWaitOnShutdown, threadPoolQueue
asyncJobAcquisitionThread, asyncJobLockTimeInMillis, asyncJobsDueRunnable, commandExecutor, defaultAsyncJobAcquireWaitTimeInMillis, defaultQueueSizeFullWaitTime, defaultTimerJobAcquireWaitTimeInMillis, executeAsyncRunnableFactory, isActive, isAutoActivate, keepAliveTime, lockOwner, maxAsyncJobsDuePerAcquisition, maxTimerJobsPerAcquisition, retryWaitTimeInMillis, temporaryJobQueue, timerJobAcquisitionThread, timerJobRunnable, timerLockTimeInMillis
Constructor and Description |
---|
SpringAsyncExecutor() |
SpringAsyncExecutor(org.springframework.core.task.TaskExecutor taskExecutor,
SpringRejectedJobsHandler rejectedJobsHandler) |
Modifier and Type | Method and Description |
---|---|
boolean |
executeAsyncJob(JobEntity job) |
SpringRejectedJobsHandler |
getRejectedJobsHandler() |
org.springframework.core.task.TaskExecutor |
getTaskExecutor() |
void |
setRejectedJobsHandler(SpringRejectedJobsHandler rejectedJobsHandler)
Required spring injected
RejectedJobsHandler 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. |
protected void |
startExecutingAsyncJobs() |
protected void |
stopExecutingAsyncJobs() |
createRunnableForJob, executeAsyncJob, getCorePoolSize, getExecutorService, getMaxPoolSize, getQueueSize, getSecondsToWaitOnShutdown, getThreadPoolQueue, setCorePoolSize, setExecutorService, setMaxPoolSize, setQueueSize, setSecondsToWaitOnShutdown, setThreadPoolQueue, unlockJob
doUnlockJob, getAsyncJobLockTimeInMillis, getCommandExecutor, getDefaultAsyncJobAcquireWaitTimeInMillis, getDefaultQueueSizeFullWaitTimeInMillis, getDefaultTimerJobAcquireWaitTimeInMillis, getExecuteAsyncRunnableFactory, getKeepAliveTime, getLockOwner, getMaxAsyncJobsDuePerAcquisition, getMaxTimerJobsPerAcquisition, getRetryWaitTimeInMillis, getTimerLockTimeInMillis, initialize, isActive, isAutoActivate, setAsyncJobLockTimeInMillis, setAsyncJobsDueRunnable, setAutoActivate, setCommandExecutor, setDefaultAsyncJobAcquireWaitTimeInMillis, setDefaultQueueSizeFullWaitTimeInMillis, setDefaultTimerJobAcquireWaitTimeInMillis, setExecuteAsyncRunnableFactory, setKeepAliveTime, setLockOwner, setMaxAsyncJobsDuePerAcquisition, setMaxTimerJobsPerAcquisition, setRetryWaitTimeInMillis, setTimerJobRunnable, setTimerLockTimeInMillis, shutdown, start, startJobAcquisitionThread, stopJobAcquisitionThread
protected org.springframework.core.task.TaskExecutor taskExecutor
protected SpringRejectedJobsHandler rejectedJobsHandler
public SpringAsyncExecutor()
public SpringAsyncExecutor(org.springframework.core.task.TaskExecutor taskExecutor, SpringRejectedJobsHandler rejectedJobsHandler)
public org.springframework.core.task.TaskExecutor getTaskExecutor()
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor)
TaskExecutor
implementation that will be
used to execute runnable jobs.taskExecutor
- public SpringRejectedJobsHandler getRejectedJobsHandler()
public void setRejectedJobsHandler(SpringRejectedJobsHandler rejectedJobsHandler)
RejectedJobsHandler
implementation that will be
used when jobs were rejected by the task executor.taskExecutor
- public boolean executeAsyncJob(JobEntity job)
executeAsyncJob
in interface AsyncExecutor
executeAsyncJob
in class AbstractAsyncJobExecutor
protected void startExecutingAsyncJobs()
startExecutingAsyncJobs
in class DefaultAsyncJobExecutor
protected void stopExecutingAsyncJobs()
stopExecutingAsyncJobs
in class DefaultAsyncJobExecutor
Copyright © 2016 Alfresco. All rights reserved.