Package org.redisson.api
Class WorkerOptions
- java.lang.Object
-
- org.redisson.api.WorkerOptions
-
public final class WorkerOptions extends Object
Configuration for RExecutorService workers.- Author:
- Nikita Koksharov
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description WorkerOptions
addListener(TaskListener listener)
Adds task listenerWorkerOptions
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 momentWorkerOptions
workers(int workers)
Defines workers amount used to execute tasks.
-
-
-
Method Detail
-
defaults
public static WorkerOptions defaults()
-
getWorkers
public int getWorkers()
-
workers
public WorkerOptions workers(int workers)
Defines workers amount used to execute tasks. Default is1
.- Parameters:
workers
- - workers amount- Returns:
- self instance
-
getBeanFactory
public org.springframework.beans.factory.BeanFactory getBeanFactory()
-
beanFactory
public 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.- Parameters:
beanFactory
- - Spring BeanFactory instance- Returns:
- self instance
-
getExecutorService
public ExecutorService getExecutorService()
-
executorService
public WorkerOptions executorService(ExecutorService executorService)
Defines custom ExecutorService to execute tasks.Config.setExecutor(ExecutorService)
is used by default.- Parameters:
executorService
- - custom ExecutorService- Returns:
- self instance
-
taskTimeout
public WorkerOptions taskTimeout(long timeout, TimeUnit unit)
Defines task timeout since task execution start moment- Parameters:
timeout
- - timeout of taskunit
- - time unit- Returns:
- self instance
-
getTaskTimeout
public long getTaskTimeout()
-
addListener
public WorkerOptions addListener(TaskListener listener)
Adds task listener- Parameters:
listener
- - task listener- Returns:
- self instance
- See Also:
TaskSuccessListener
,TaskFailureListener
,TaskStartedListener
,TaskFinishedListener
-
getListeners
public List<TaskListener> getListeners()
-
-