Class DefaultExecutorSelector

  • All Implemented Interfaces:
    ExecutorSelector

    @Singleton
    public class DefaultExecutorSelector
    extends java.lang.Object
    implements ExecutorSelector
    Default implementation of the ExecutorSelector interface that regards methods that return reactive types as non-blocking.
    Since:
    1.0
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected DefaultExecutorSelector​(io.micronaut.context.BeanLocator beanLocator, io.micronaut.context.BeanProvider<java.util.concurrent.ExecutorService> ioExecutor)
      Default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Optional<java.util.concurrent.ExecutorService> select​(io.micronaut.inject.MethodReference method, ThreadSelection threadSelection)
      Select an ExecutorService for the given MethodReference.
      java.util.Optional<java.util.concurrent.ExecutorService> select​(java.lang.String name)
      Obtain executor for the given name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DefaultExecutorSelector

        @Inject
        protected DefaultExecutorSelector​(io.micronaut.context.BeanLocator beanLocator,
                                          @Named("io")
                                          io.micronaut.context.BeanProvider<java.util.concurrent.ExecutorService> ioExecutor)
        Default constructor.
        Parameters:
        beanLocator - The bean locator
        ioExecutor - The IO executor
    • Method Detail

      • select

        public java.util.Optional<java.util.concurrent.ExecutorService> select​(io.micronaut.inject.MethodReference method,
                                                                               ThreadSelection threadSelection)
        Description copied from interface: ExecutorSelector
        Select an ExecutorService for the given MethodReference.
        Specified by:
        select in interface ExecutorSelector
        Parameters:
        method - The MethodReference
        threadSelection - The thread selection mode
        Returns:
        An optional ExecutorService. If an ExecutorService cannot be established Optional.empty() is returned
      • select

        public java.util.Optional<java.util.concurrent.ExecutorService> select​(java.lang.String name)
        Description copied from interface: ExecutorSelector
        Obtain executor for the given name.
        Specified by:
        select in interface ExecutorSelector
        Parameters:
        name - The name of the executor
        Returns:
        An executor if it exists