Package io.micronaut.scheduling.executor
Class DefaultExecutorSelector
- java.lang.Object
-
- io.micronaut.scheduling.executor.DefaultExecutorSelector
-
- All Implemented Interfaces:
ExecutorSelector
@Singleton public class DefaultExecutorSelector extends java.lang.Object implements ExecutorSelector
Default implementation of theExecutorSelector
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 anExecutorService
for the givenMethodReference
.java.util.Optional<java.util.concurrent.ExecutorService>
select(java.lang.String name)
Obtain executor for the given name.
-
-
-
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 locatorioExecutor
- 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 anExecutorService
for the givenMethodReference
.- Specified by:
select
in interfaceExecutorSelector
- Parameters:
method
- TheMethodReference
threadSelection
- The thread selection mode- Returns:
- An optional
ExecutorService
. If anExecutorService
cannot be establishedOptional.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 interfaceExecutorSelector
- Parameters:
name
- The name of the executor- Returns:
- An executor if it exists
-
-