Class WorkerOptions

java.lang.Object
org.redisson.api.WorkerOptions

public final class WorkerOptions extends Object
Configuration for RExecutorService workers.
Author:
Nikita Koksharov
  • Method Details

    • defaults

      public static WorkerOptions defaults()
    • getWorkers

      public int getWorkers()
    • workers

      public WorkerOptions workers(int workers)
      Defines workers amount used to execute tasks. Default is 1.
      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
    • getTasksInjector

      public TasksInjector getTasksInjector()
    • 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 task
      unit - - 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:
    • getListeners

      public List<TaskListener> getListeners()