@Singleton public class DefaultExecutorSelector extends Object implements ExecutorSelector
ExecutorSelector
interface that regards methods that return reactive types as non-blocking.Modifier | Constructor and Description |
---|---|
protected |
DefaultExecutorSelector(BeanLocator beanLocator,
BeanProvider<ExecutorService> ioExecutor)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
Optional<ExecutorService> |
select(MethodReference method,
ThreadSelection threadSelection)
Select an
ExecutorService for the given MethodReference . |
Optional<ExecutorService> |
select(String name)
Obtain executor for the given name.
|
@Inject protected DefaultExecutorSelector(BeanLocator beanLocator, @Named(value="io") BeanProvider<ExecutorService> ioExecutor)
beanLocator
- The bean locatorioExecutor
- The IO executorpublic Optional<ExecutorService> select(MethodReference method, ThreadSelection threadSelection)
ExecutorSelector
ExecutorService
for the given MethodReference
.select
in interface ExecutorSelector
method
- The MethodReference
threadSelection
- The thread selection modeExecutorService
. If an ExecutorService
cannot be established
Optional.empty()
is returnedpublic Optional<ExecutorService> select(String name)
ExecutorSelector
select
in interface ExecutorSelector
name
- The name of the executor