Package io.micronaut.scheduling.executor
Class DefaultExecutorSelector
java.lang.Object
io.micronaut.scheduling.executor.DefaultExecutorSelector
- All Implemented Interfaces:
ExecutorSelector
Default implementation of the
ExecutorSelector
interface that regards methods that return reactive types as non-blocking.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Constructor Summary
ModifierConstructorDescriptionprotected
DefaultExecutorSelector
(BeanLocator beanLocator, BeanProvider<ExecutorService> ioExecutor, BeanProvider<ExecutorService> blockingExecutor) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionselect
(MethodReference<?, ?> method, ThreadSelection threadSelection) Select anExecutorService
for the givenMethodReference
.Obtain executor for the given name.
-
Constructor Details
-
DefaultExecutorSelector
@Inject protected DefaultExecutorSelector(BeanLocator beanLocator, @Named("io") BeanProvider<ExecutorService> ioExecutor, @Named("blocking") BeanProvider<ExecutorService> blockingExecutor) Default constructor.- Parameters:
beanLocator
- The bean locatorioExecutor
- The IO executorblockingExecutor
- The blocking executor
-
-
Method Details
-
select
public Optional<ExecutorService> select(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
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
-