Class ExecutorFactory


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

      Constructors 
      Constructor Description
      ExecutorFactory​(io.micronaut.context.BeanLocator beanLocator, java.util.concurrent.ThreadFactory threadFactory)  
    • Constructor Detail

      • ExecutorFactory

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

      • eventLoopGroupThreadFactory

        @EachBean(ExecutorConfiguration.class)
        protected java.util.concurrent.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 java.util.concurrent.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