Enum Class ThreadSelection

java.lang.Object
java.lang.Enum<ThreadSelection>
io.micronaut.scheduling.executor.ThreadSelection
All Implemented Interfaces:
Serializable, Comparable<ThreadSelection>, Constable

public enum ThreadSelection extends Enum<ThreadSelection>
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 Constants
    Enum Constant
    Description
    Automatically select the thread to run operations on based on the return type and/or Blocking or NonBlocking annotations.
    I/O selection will run all operations regardless of return type and annotations on the blocking 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 Type
    Method
    Description
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • AUTO

      public static final ThreadSelection AUTO
      Automatically select the thread to run operations on based on the return type and/or Blocking or NonBlocking 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 with NonBlocking

      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

      public static final ThreadSelection 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 to subscribeOn(..) or by using the Async annotation or whatever mechanism the user chooses to spawn the additional thread.
    • IO

      public static final ThreadSelection 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

      public static final ThreadSelection BLOCKING
      I/O selection will run all operations regardless of return type and annotations on the blocking executor and will never schedule an operation on the server event loop thread.
  • Method Details

    • values

      public static ThreadSelection[] 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

      public static ThreadSelection valueOf(String name)
      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 name
      NullPointerException - if the argument is null