Class ExecutorFactory

java.lang.Object
io.micronaut.scheduling.executor.ExecutorFactory

@Factory public class ExecutorFactory extends Object
Constructs ExecutorService instances based on UserExecutorConfiguration instances.
Since:
1.0
  • Constructor Details

    • ExecutorFactory

      @Inject public ExecutorFactory(io.micronaut.context.BeanLocator beanLocator, ThreadFactory threadFactory)
      Parameters:
      beanLocator - The bean beanLocator
      threadFactory - The factory to create new threads
      Since:
      2.0.1
  • Method Details

    • eventLoopGroupThreadFactory

      @EachBean(ExecutorConfiguration.class) protected ThreadFactory eventLoopGroupThreadFactory(ExecutorConfiguration configuration)
      Constructs an executor thread factory.
      Parameters:
      configuration - The configuration
      Returns:
      The thread factory
    • executorService

      @EachBean(ExecutorConfiguration.class) @Bean(preDestroy="shutdown") public ExecutorService executorService(ExecutorConfiguration executorConfiguration)
      Create the ExecutorService with the given configuration.
      Parameters:
      executorConfiguration - The configuration to create a thread pool that creates new threads as needed
      Returns:
      A thread pool that creates new threads as needed