Class ReactorNetty
- Author:
- Stephane Maldini
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSpecifies whether the Http Server access log will be enabled.static final StringSpecifies whether the Http Server error log will be enabled.static final StringDefault selector thread count, fallback to -1 (no selector thread)static final StringDefault worker thread count, fallback to available processor (but with a minimum value of 4).static final StringDefault value whether the native transport (epoll, io_uring, kqueue) will be preferred, fallback it will be preferred when available.static final StringDefault acquisition timeout (milliseconds) before error.static final StringDefaultgetPermitsSamplingRate(between 0d and 1d (percentage)) to be used with aSamplingAllocationStrategy.static final StringDefault leasing strategy (fifo, lifo), fallback to fifo.static final StringDefault max connections.static final StringDefault max idle time, fallback - max idle time is not specified.static final StringDefault max life time, fallback - max life time is not specified.static final StringDefaultreturnPermitsSamplingRate(between 0d and 1d (percentage)) to be used with aSamplingAllocationStrategy.static final StringDefault prefetch size (Subscription.request(long)) for data stream Publisher, fallback to 128.static final StringDefault quiet period that guarantees that the disposal of the underlying LoopResources will not happen, fallback to 2 seconds.static final StringDefault maximum amount of time to wait until the disposal of the underlying LoopResources regardless if a task was submitted during the quiet period, fallback to 15 seconds.static final StringDefault value whether the SSL debugging on the client side will be enabled/disabled, fallback to SSL debugging disabled.static final StringDefault SSL handshake timeout (milliseconds), fallback to 10 seconds.static final StringDefault value whether the SSL debugging on the server side will be enabled/disabled, fallback to SSL debugging disabled.static final StringDefault worker thread count for UDP, fallback to available processor (but with a minimum value of 4).static final ZoneIdSpecifies the zone id used by the access log. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringAppend channel ID to a log message for correlated traces.static @Nullable ContextViewgetChannelContext(Channel channel) ReturnsContextViewfrom the channel attributes when exists otherwise returnsnull.static voidsafeRelease(Object msg) Try to callReferenceCounted.release()if the specified message implementsReferenceCounted.static voidsetChannelContext(Channel channel, @Nullable ContextView contextView) AddsContextViewto the channel attributes.static StringtoPrettyHexDump(Object msg) Deprecated.as of 1.1.0.static RuntimeExceptionwrapException(Throwable throwable) Wrap possibly fatal or singleton exception into a new exception instance in order to propagate in reactor flows without side effect.
-
Field Details
-
IO_WORKER_COUNT
Default worker thread count, fallback to available processor (but with a minimum value of 4).- See Also:
-
IO_SELECT_COUNT
Default selector thread count, fallback to -1 (no selector thread)Note: In most use cases using a worker thread also as a selector thread works well. A possible use case for specifying a separate selector thread might be when the worker threads are too busy and connections cannot be accepted fast enough.
Note: Although more than 1 can be configured as a selector thread count, in reality only 1 thread will be used as a selector thread.
- See Also:
-
UDP_IO_THREAD_COUNT
Default worker thread count for UDP, fallback to available processor (but with a minimum value of 4).- See Also:
-
SHUTDOWN_QUIET_PERIOD
Default quiet period that guarantees that the disposal of the underlying LoopResources will not happen, fallback to 2 seconds.- See Also:
-
SHUTDOWN_TIMEOUT
Default maximum amount of time to wait until the disposal of the underlying LoopResources regardless if a task was submitted during the quiet period, fallback to 15 seconds.- See Also:
-
NATIVE
Default value whether the native transport (epoll, io_uring, kqueue) will be preferred, fallback it will be preferred when available.Note: On
Linux,Epollwill be preferred by default. IfIO_Uringneeds to be configured, a dependency toio.netty:netty-transport-native-io_uringhas to be added.- See Also:
-
POOL_MAX_CONNECTIONS
Default max connections. Fallback to 2 * available number of processors (but with a minimum value of 16)- See Also:
-
POOL_ACQUIRE_TIMEOUT
Default acquisition timeout (milliseconds) before error. If -1 will never wait to acquire before opening a new connection in an unbounded fashion. Fallback 45 seconds- See Also:
-
POOL_MAX_IDLE_TIME
Default max idle time, fallback - max idle time is not specified.Note: This configuration is not applicable for
TcpClient. A TCP connection is always closed and never returned to the pool.- See Also:
-
POOL_MAX_LIFE_TIME
Default max life time, fallback - max life time is not specified.Note: This configuration is not applicable for
TcpClient. A TCP connection is always closed and never returned to the pool.- See Also:
-
POOL_LEASING_STRATEGY
Default leasing strategy (fifo, lifo), fallback to fifo.- fifo - The connection selection is first in, first out
- lifo - The connection selection is last in, first out
Note: This configuration is not applicable for
TcpClient. A TCP connection is always closed and never returned to the pool.- See Also:
-
POOL_GET_PERMITS_SAMPLING_RATE
DefaultgetPermitsSamplingRate(between 0d and 1d (percentage)) to be used with aSamplingAllocationStrategy. This strategy wraps asizeBetweenAllocationStrategyand samples calls toAllocationStrategy.getPermits(int). Fallback - sampling is not enabled.- See Also:
-
POOL_RETURN_PERMITS_SAMPLING_RATE
DefaultreturnPermitsSamplingRate(between 0d and 1d (percentage)) to be used with aSamplingAllocationStrategy. This strategy wraps asizeBetweenAllocationStrategyand samples calls toAllocationStrategy.returnPermits(int). Fallback - sampling is not enabled.- See Also:
-
SSL_HANDSHAKE_TIMEOUT
Default SSL handshake timeout (milliseconds), fallback to 10 seconds.- See Also:
-
SSL_CLIENT_DEBUG
Default value whether the SSL debugging on the client side will be enabled/disabled, fallback to SSL debugging disabled.- See Also:
-
SSL_SERVER_DEBUG
Default value whether the SSL debugging on the server side will be enabled/disabled, fallback to SSL debugging disabled.- See Also:
-
ACCESS_LOG_ENABLED
Specifies whether the Http Server access log will be enabled. By default, it is disabled.- See Also:
-
ERROR_LOG_ENABLED
Specifies whether the Http Server error log will be enabled. By default, it is disabled.- See Also:
-
ZONE_ID_SYSTEM
Specifies the zone id used by the access log. -
REACTOR_NETTY_SEND_MAX_PREFETCH_SIZE
Default prefetch size (Subscription.request(long)) for data stream Publisher, fallback to 128.- See Also:
-
PREDICATE_GROUP_FLUSH
-
-
Method Details
-
safeRelease
Try to callReferenceCounted.release()if the specified message implementsReferenceCounted. If the specified message doesn't implementReferenceCountedor it is already released, this method does nothing. -
format
Append channel ID to a log message for correlated traces.- Parameters:
channel- current channel associated with the msgmsg- the log msg- Returns:
- a formatted msg
-
toPrettyHexDump
Deprecated.as of 1.1.0. This will be removed in 2.0.0 as the functionality is not used anymore.Pretty hex dump will be returned when the object isByteBuforByteBufHolder. -
getChannelContext
ReturnsContextViewfrom the channel attributes when exists otherwise returnsnull.- Parameters:
channel- the channel- Returns:
ContextViewfrom the channel attributes when exists otherwise returnsnull- Since:
- 1.0.26
-
setChannelContext
AddsContextViewto the channel attributes. Whennullis provided, the channel attribute's value will be deleted.- Parameters:
channel- the channelcontextView-ContextViewthat will be added to the channel attributes- Since:
- 1.0.26
-
wrapException
Wrap possibly fatal or singleton exception into a new exception instance in order to propagate in reactor flows without side effect.- Returns:
- a wrapped
RuntimeException
-