Class NettyHttpServerConfiguration.EventLoopConfig
java.lang.Object
io.micronaut.http.server.netty.configuration.NettyHttpServerConfiguration.EventLoopConfig
- All Implemented Interfaces:
Named,EventLoopGroupConfiguration
- Direct Known Subclasses:
NettyHttpServerConfiguration.Parent,NettyHttpServerConfiguration.Worker
- Enclosing class:
- NettyHttpServerConfiguration
public abstract static class NettyHttpServerConfiguration.EventLoopConfig
extends Object
implements EventLoopGroupConfiguration
Abstract class for configuring the Netty event loop.
-
Field Summary
Fields inherited from interface io.micronaut.http.netty.channel.EventLoopGroupConfiguration
DEFAULT, DEFAULT_LOOP, DEFAULT_SHUTDOWN_QUIET_PERIOD, DEFAULT_SHUTDOWN_TIMEOUT, DEFAULT_THREAD_CORE_RATIO, EVENT_LOOPS -
Method Summary
Modifier and TypeMethodDescriptiongetName()intintdoubleThe number of threads per core to use ifEventLoopGroupConfiguration.getNumThreads()is set to 0.booleanbooleanvoidsetEventLoopGroup(String name) Sets the name to use.voidsetExecutor(String executor) A named executor service to use for event loop threads (optional).voidsetIoRatio(Integer ioRatio) Sets the I/O ratio.voidsetLoomCarrier(boolean loomCarrier) voidsetPreferNativeTransport(boolean preferNativeTransport) voidsetShutdownQuietPeriod(Duration shutdownQuietPeriod) voidsetShutdownTimeout(Duration shutdownTimeout) voidsetThreadCoreRatio(double threadCoreRatio) The number of threads per core to use ifgetNumThreads()is set to 0.voidsetThreads(int threads) Sets the number of threads for the event loop group.
-
Method Details
-
getName
-
setEventLoopGroup
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
Sets the I/O ratio.- Parameters:
ioRatio- The I/O ratio
-
setExecutor
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
- Parameters:
shutdownQuietPeriod- Set the shutdown quiet period
-
setShutdownTimeout
- Parameters:
shutdownTimeout- Set the shutdown timeout (must be >= shutdownQuietPeriod)
-
getNumOfThreads
public int getNumOfThreads()- Returns:
- The number of threads to use
-
getIoRatio
- Specified by:
getIoRatioin interfaceEventLoopGroupConfiguration- Returns:
- The I/O ratio to use
-
getExecutorName
- Specified by:
getExecutorNamein interfaceEventLoopGroupConfiguration- Returns:
- The name of the configured executor to use
-
getNumThreads
public int getNumThreads()- Specified by:
getNumThreadsin interfaceEventLoopGroupConfiguration- Returns:
- The number of threads for the event loop, or 0 to use
EventLoopGroupConfiguration.getThreadCoreRatio()
-
getThreadCoreRatio
public double getThreadCoreRatio()Description copied from interface:EventLoopGroupConfigurationThe number of threads per core to use ifEventLoopGroupConfiguration.getNumThreads()is set to 0.- Specified by:
getThreadCoreRatioin interfaceEventLoopGroupConfiguration- Returns:
- The thread-to-core ratio
-
setThreadCoreRatio
public void setThreadCoreRatio(double threadCoreRatio) The number of threads per core to use ifgetNumThreads()is set to 0.- Parameters:
threadCoreRatio- The thread-to-core ratio- Since:
- 4.8.0
-
isPreferNativeTransport
public boolean isPreferNativeTransport()- Specified by:
isPreferNativeTransportin interfaceEventLoopGroupConfiguration- Returns:
- Whether to prefer the native transport
-
getShutdownQuietPeriod
- Specified by:
getShutdownQuietPeriodin interfaceEventLoopGroupConfiguration- Returns:
- The shutdown quiet period
-
getShutdownTimeout
- Specified by:
getShutdownTimeoutin interfaceEventLoopGroupConfiguration- Returns:
- The shutdown timeout (must be >= shutdownQuietPeriod)
-
isLoomCarrier
public boolean isLoomCarrier()- Specified by:
isLoomCarrierin interfaceEventLoopGroupConfiguration- Returns:
- When set to
true, use a special experimental event loop that can also execute virtual threads, in order to improve virtual thread performance.
-
setLoomCarrier
public void setLoomCarrier(boolean loomCarrier) - Parameters:
loomCarrier- When set totrue, use a special experimental event loop that can also execute virtual threads, in order to improve virtual thread performance.
-