Package io.micronaut.scheduling.executor
Enum Class ThreadSelection
- All Implemented Interfaces:
Serializable
,Comparable<ThreadSelection>
,Constable
Enum the controls the ability to select threads in a Micronaut application.
- Since:
- 1.3
- Author:
- graemerocher
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionAutomatically select the thread to run operations on based on the return type and/orBlocking
orNonBlocking
annotations.I/O selection will run all operations regardless of return type and annotations on theblocking executor
and will never schedule an operation on the server event loop thread.I/O selection will run all operations regardless of return type and annotations on the I/O thread pool and will never schedule an operation on the server event loop thread.Manual selection leaves it up to the user code to spawn threads to run any blocking I/O operations. -
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadSelection
Returns the enum constant of this class with the specified name.static ThreadSelection[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
AUTO
Automatically select the thread to run operations on based on the return type and/orBlocking
orNonBlocking
annotations.This is the default strategy in 1.x and will run operations on the
blocking executor
if the return type of the method is not a reactive top and the method is not annotated withNonBlocking
If the return type is a reactive type and the method is not annotated with
Blocking
then the server event loop thread will used to run the operation. -
MANUAL
Manual selection leaves it up to the user code to spawn threads to run any blocking I/O operations. This could be via an appropriate call tosubscribeOn(..)
or by using theAsync
annotation or whatever mechanism the user chooses to spawn the additional thread. -
IO
I/O selection will run all operations regardless of return type and annotations on the I/O thread pool and will never schedule an operation on the server event loop thread. -
BLOCKING
I/O selection will run all operations regardless of return type and annotations on theblocking executor
and will never schedule an operation on the server event loop thread.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-