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
ConstructorsModifierConstructorDescriptionprotectedDefaultExecutorSelector(BeanLocator beanLocator, BeanProvider<ExecutorService> ioExecutor, BeanProvider<ExecutorService> blockingExecutor) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionselect(@Nullable MethodReference<?, ?> method, ThreadSelection threadSelection) Select anExecutorServicefor the givenMethodReference.Obtain executor for the given name.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ExecutorSelector
selectExecutor
-
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(@Nullable 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
-