public final class WorkerOptions extends Object
| Modifier and Type | Method and Description |
|---|---|
WorkerOptions |
addListener(TaskListener listener)
Adds task listener
|
WorkerOptions |
beanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
Defines Spring BeanFactory instance to execute tasks with Spring's '@Autowired',
'@Value' or JSR-330's '@Inject' annotation.
|
static WorkerOptions |
defaults() |
WorkerOptions |
executorService(ExecutorService executorService)
Defines custom ExecutorService to execute tasks.
|
org.springframework.beans.factory.BeanFactory |
getBeanFactory() |
ExecutorService |
getExecutorService() |
List<TaskListener> |
getListeners() |
long |
getTaskTimeout() |
int |
getWorkers() |
WorkerOptions |
taskTimeout(long timeout,
TimeUnit unit)
Defines task timeout since task execution start moment
|
WorkerOptions |
workers(int workers)
Defines workers amount used to execute tasks.
|
public static WorkerOptions defaults()
public int getWorkers()
public WorkerOptions workers(int workers)
1.workers - - workers amountpublic org.springframework.beans.factory.BeanFactory getBeanFactory()
public WorkerOptions beanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
beanFactory - - Spring BeanFactory instancepublic ExecutorService getExecutorService()
public WorkerOptions executorService(ExecutorService executorService)
Config.setExecutor(ExecutorService) is used by default.executorService - - custom ExecutorServicepublic WorkerOptions taskTimeout(long timeout, TimeUnit unit)
timeout - - timeout of taskunit - - time unitpublic long getTaskTimeout()
public WorkerOptions addListener(TaskListener listener)
listener - - task listenerTaskSuccessListener,
TaskFailureListener,
TaskStartedListener,
TaskFinishedListenerpublic List<TaskListener> getListeners()
Copyright © 2014–2021 Redisson. All rights reserved.