Class ReactorNetty
- Author:
- Stephane Maldini
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Specifies whether the Http Server access log will be enabled.static final String
Specifies whether the Http Server error log will be enabled.static final String
Default selector thread count, fallback to -1 (no selector thread)static final String
Default worker thread count, fallback to available processor (but with a minimum value of 4).static final String
Default value whether the native transport (epoll, io_uring, kqueue) will be preferred, fallback it will be preferred when available.static final String
Default acquisition timeout (milliseconds) before error.static final String
DefaultgetPermitsSamplingRate
(between 0d and 1d (percentage)) to be used with aSamplingAllocationStrategy
.static final String
Default leasing strategy (fifo, lifo), fallback to fifo.static final String
Default max connections.static final String
Default max idle time, fallback - max idle time is not specified.static final String
Default max life time, fallback - max life time is not specified.static final String
DefaultreturnPermitsSamplingRate
(between 0d and 1d (percentage)) to be used with aSamplingAllocationStrategy
.static final String
Default prefetch size (Subscription.request(long)
) for data stream Publisher, fallback to 128.static final String
Default quiet period that guarantees that the disposal of the underlying LoopResources will not happen, fallback to 2 seconds.static final String
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.static final String
Default value whether the SSL debugging on the client side will be enabled/disabled, fallback to SSL debugging disabled.static final String
Default SSL handshake timeout (milliseconds), fallback to 10 seconds.static final String
Default value whether the SSL debugging on the server side will be enabled/disabled, fallback to SSL debugging disabled.static final String
Default worker thread count for UDP, fallback to available processor (but with a minimum value of 4).static final ZoneId
Specifies the zone id used by the access log. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Append channel ID to a log message for correlated traces.static @Nullable ContextView
getChannelContext
(Channel channel) ReturnsContextView
from the channel attributes when exists otherwise returnsnull
.static void
safeRelease
(Object msg) Try to callReferenceCounted.release()
if the specified message implementsReferenceCounted
.static void
setChannelContext
(Channel channel, @Nullable ContextView contextView) AddsContextView
to the channel attributes.static String
toPrettyHexDump
(Object msg) Deprecated.as of 1.1.0.static RuntimeException
wrapException
(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
,Epoll
will be preferred by default. IfIO_Uring
needs to be configured, a dependency toio.netty:netty-transport-native-io_uring
has 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 asizeBetween
AllocationStrategy
and 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 asizeBetween
AllocationStrategy
and 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 implementReferenceCounted
or 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 isByteBuf
orByteBufHolder
. -
getChannelContext
ReturnsContextView
from the channel attributes when exists otherwise returnsnull
.- Parameters:
channel
- the channel- Returns:
ContextView
from the channel attributes when exists otherwise returnsnull
- Since:
- 1.0.26
-
setChannelContext
AddsContextView
to the channel attributes. Whennull
is provided, the channel attribute's value will be deleted.- Parameters:
channel
- the channelcontextView
-ContextView
that 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
-