Class NettyHttpServerConfiguration.EventLoopConfig

java.lang.Object
io.micronaut.http.server.netty.configuration.NettyHttpServerConfiguration.EventLoopConfig
All Implemented Interfaces:
io.micronaut.core.naming.Named, io.micronaut.http.netty.channel.EventLoopGroupConfiguration
Direct Known Subclasses:
NettyHttpServerConfiguration.Parent, NettyHttpServerConfiguration.Worker
Enclosing class:
NettyHttpServerConfiguration

public abstract static class NettyHttpServerConfiguration.EventLoopConfig extends Object implements io.micronaut.http.netty.channel.EventLoopGroupConfiguration
Abstract class for configuring the Netty event loop.
  • Method Details

    • getName

      @NonNull public @NonNull String getName()
      Specified by:
      getName in interface io.micronaut.core.naming.Named
    • setEventLoopGroup

      public void setEventLoopGroup(String name)
      Sets the name to use.
      Parameters:
      name - The name
    • setThreads

      public void setThreads(int threads)
      Sets the number of threads for the event loop group.
      Parameters:
      threads - The number of threads
    • setIoRatio

      public void setIoRatio(Integer ioRatio)
      Sets the I/O ratio.
      Parameters:
      ioRatio - The I/O ratio
    • setExecutor

      public void setExecutor(String executor)
      A named executor service to use for event loop threads (optional). This property is very specialized. In particular, it will not solve read timeouts or fix blocking operations on the event loop, in fact it may do the opposite. Don't use unless you really know what this does.
      Parameters:
      executor - The executor
    • setPreferNativeTransport

      public void setPreferNativeTransport(boolean preferNativeTransport)
      Parameters:
      preferNativeTransport - Set whether to prefer the native transport if available
    • setShutdownQuietPeriod

      public void setShutdownQuietPeriod(Duration shutdownQuietPeriod)
      Parameters:
      shutdownQuietPeriod - Set the shutdown quiet period
    • setShutdownTimeout

      public void setShutdownTimeout(Duration shutdownTimeout)
      Parameters:
      shutdownTimeout - Set the shutdown timeout (must be >= shutdownQuietPeriod)
    • getNumOfThreads

      public int getNumOfThreads()
      Returns:
      The number of threads to use
    • getIoRatio

      public Optional<Integer> getIoRatio()
      Specified by:
      getIoRatio in interface io.micronaut.http.netty.channel.EventLoopGroupConfiguration
      Returns:
      The I/O ratio to use
    • getExecutorName

      public Optional<String> getExecutorName()
      Specified by:
      getExecutorName in interface io.micronaut.http.netty.channel.EventLoopGroupConfiguration
      Returns:
      The name of the configured executor to use
    • getNumThreads

      public int getNumThreads()
      Specified by:
      getNumThreads in interface io.micronaut.http.netty.channel.EventLoopGroupConfiguration
    • getThreadCoreRatio

      public double getThreadCoreRatio()
      Specified by:
      getThreadCoreRatio in interface io.micronaut.http.netty.channel.EventLoopGroupConfiguration
    • setThreadCoreRatio

      public void setThreadCoreRatio(double threadCoreRatio)
      The number of threads per core to use if getNumThreads() is set to 0.
      Parameters:
      threadCoreRatio - The thread-to-core ratio
      Since:
      4.8.0
    • isPreferNativeTransport

      public boolean isPreferNativeTransport()
      Specified by:
      isPreferNativeTransport in interface io.micronaut.http.netty.channel.EventLoopGroupConfiguration
    • getTransport

      @NonNull public @NonNull List<String> getTransport()
      Specified by:
      getTransport in interface io.micronaut.http.netty.channel.EventLoopGroupConfiguration
    • setTransport

      public void setTransport(@NonNull @NonNull List<String> transport)
      The transports to use for this event loop, in order of preference. Supported values are io_uring,epoll,kqueue,nio. The first available transport out of those listed will be used (nio is always available). If no listed transport is available, an exception will be thrown.

      By default, only nio is used, even if native transports are available. If the legacy prefer-native-transport property is set to true, this defaults to io_uring,epoll,kqueue,nio.

      Parameters:
      transport - The available transports, in order of preference
    • getShutdownQuietPeriod

      public Duration getShutdownQuietPeriod()
      Specified by:
      getShutdownQuietPeriod in interface io.micronaut.http.netty.channel.EventLoopGroupConfiguration
    • getShutdownTimeout

      public Duration getShutdownTimeout()
      Specified by:
      getShutdownTimeout in interface io.micronaut.http.netty.channel.EventLoopGroupConfiguration
    • isLoomCarrier

      public boolean isLoomCarrier()
      Specified by:
      isLoomCarrier in interface io.micronaut.http.netty.channel.EventLoopGroupConfiguration
    • setLoomCarrier

      public void setLoomCarrier(boolean loomCarrier)
      Parameters:
      loomCarrier - When set to true, use a special experimental event loop that can also execute virtual threads, in order to improve virtual thread performance.