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
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefaultExecutorSelector(io.micronaut.context.BeanLocator beanLocator, io.micronaut.context.BeanProvider<ExecutorService> ioExecutor, io.micronaut.context.BeanProvider<ExecutorService> blockingExecutor) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionselect(io.micronaut.inject.MethodReference<?, ?> method, ThreadSelection threadSelection) Select anExecutorServicefor the givenMethodReference.Obtain executor for the given name.
-
Constructor Details
-
DefaultExecutorSelector
@Inject protected DefaultExecutorSelector(io.micronaut.context.BeanLocator beanLocator, @Named("io") io.micronaut.context.BeanProvider<ExecutorService> ioExecutor, @Named("blocking") io.micronaut.context.BeanProvider<ExecutorService> blockingExecutor) Default constructor.- Parameters:
beanLocator- The bean locatorioExecutor- The IO executorblockingExecutor- The blocking executor
-
-
Method Details
-
select
public Optional<ExecutorService> select(io.micronaut.inject.MethodReference<?, ?> method, ThreadSelection threadSelection) Description copied from interface:ExecutorSelectorSelect anExecutorServicefor the givenMethodReference.- Specified by:
selectin interfaceExecutorSelector- Parameters:
method- TheMethodReferencethreadSelection- The thread selection mode- Returns:
- An optional
ExecutorService. If anExecutorServicecannot be establishedOptional.empty()is returned
-
select
Description copied from interface:ExecutorSelectorObtain executor for the given name.- Specified by:
selectin interfaceExecutorSelector- Parameters:
name- The name of the executor- Returns:
- An executor if it exists
-