Package reactor.netty.transport
Class TransportConfig
java.lang.Object
reactor.netty.transport.TransportConfig
- Direct Known Subclasses:
ClientTransportConfig
,QuicClientConfig
,QuicServerConfig
,ServerTransportConfig
,UdpServerConfig
A basic configuration holder. The public API is read-only.
- Since:
- 1.0.0
- Author:
- Stephane Maldini, Violeta Georgieva
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TransportConfig
(Map<ChannelOption<?>, ?> options) Default TransportConfig with options.protected
TransportConfig
(Map<ChannelOption<?>, ?> options, Supplier<? extends SocketAddress> bindAddress) Default TransportConfig with options.protected
TransportConfig
(TransportConfig parent) Create TransportConfig from an existing one. -
Method Summary
Modifier and TypeMethodDescriptionfinal Map<AttributeKey<?>,
?> Return the read-only default channel attributes.final @Nullable Supplier<? extends SocketAddress>
Return the localSocketAddress
supplier that will be bound or null.protected void
bindAddress
(Supplier<? extends SocketAddress> bindAddressSupplier) final @Nullable ChannelGroup
Return the configuredChannelGroup
or null.int
channelInitializer
(ConnectionObserver connectionObserver, @Nullable SocketAddress remoteAddress, boolean onServer) Return theChannelInitializer
that will be used for initializing the channel pipeline.Return the associatedChannelOperations.OnSetup
, config implementations might override this.channelType
(boolean isDomainSocket) Return the channel type this configuration is associated with, it can be one of the following.protected ChannelFactory<? extends Channel>
connectionFactory
(EventLoopGroup elg, boolean isDomainSocket) Return theChannelFactory
which is used to createChannel
instances.final ConnectionObserver
Return the configuredConnectionObserver
if any orConnectionObserver.emptyListener()
.protected abstract ConnectionObserver
Return the configured defaultConnectionObserver
.protected abstract LoggingHandler
Return the defaultLoggingHandler
to wiretap this transport.protected abstract LoopResources
Return the defaultLoopResources
for this transport.protected abstract ChannelMetricsRecorder
Return the configured metrics recorder.protected abstract ChannelPipelineConfigurer
Return the default callback if any orChannelPipelineConfigurer.emptyConfigurer()
.Return the configured callback if any orChannelPipelineConfigurer.emptyConfigurer()
.protected abstract EventLoopGroup
Return the configuredEventLoopGroup
.final boolean
Returntrue
if prefer native event loop and channel factory (e.g.final @Nullable LoggingHandler
Return the configuredLoggingHandler
or null.protected void
loggingHandler
(LoggingHandler loggingHandler) final LoopResources
Return the configuredLoopResources
or the default.final @Nullable Supplier<? extends ChannelMetricsRecorder>
Return the configured metrics recorderChannelMetricsRecorder
or null.protected void
metricsRecorder
(@Nullable Supplier<? extends ChannelMetricsRecorder> metricsRecorderSupplier) Obtains immediately theChannelMetricsRecorder
from the providedSupplier
.protected @Nullable ChannelMetricsRecorder
final Map<ChannelOption<?>,
?> options()
Return the read-onlyChannelOption
map.protected static <K,
V> Map<K, V> Add or remove values to a map in an immutable way by returning a new map instance.
-
Constructor Details
-
TransportConfig
Default TransportConfig with options. -
TransportConfig
protected TransportConfig(Map<ChannelOption<?>, ?> options, Supplier<? extends SocketAddress> bindAddress) Default TransportConfig with options. -
TransportConfig
Create TransportConfig from an existing one.
-
-
Method Details
-
attributes
Return the read-only default channel attributes.- Returns:
- the read-only default channel attributes
-
bindAddress
Return the localSocketAddress
supplier that will be bound or null.- Returns:
- the
SocketAddress
supplier
-
channelHash
public int channelHash() -
channelGroup
Return the configuredChannelGroup
or null.- Returns:
- the configured
ChannelGroup
or null
-
channelInitializer
public ChannelInitializer<Channel> channelInitializer(ConnectionObserver connectionObserver, @Nullable SocketAddress remoteAddress, boolean onServer) Return theChannelInitializer
that will be used for initializing the channel pipeline.- Parameters:
connectionObserver
- the configuredConnectionObserver
remoteAddress
- the remote addressonServer
- channel initializer for the server or for the client- Returns:
- the
ChannelInitializer
that will be used for initializing the channel pipeline
-
channelOperationsProvider
Return the associatedChannelOperations.OnSetup
, config implementations might override this.- Returns:
- the associated
ChannelOperations.OnSetup
-
connectionObserver
Return the configuredConnectionObserver
if any orConnectionObserver.emptyListener()
.- Returns:
- the configured
ConnectionObserver
if any orConnectionObserver.emptyListener()
-
doOnChannelInit
Return the configured callback if any orChannelPipelineConfigurer.emptyConfigurer()
.- Returns:
- the configured callback if any or
ChannelPipelineConfigurer.emptyConfigurer()
-
isPreferNative
public final boolean isPreferNative()Returntrue
if prefer native event loop and channel factory (e.g. epoll, io_uring or kqueue).- Returns:
true
if prefer native event loop and channel factory (e.g. epoll, io_uring or kqueue)
-
loggingHandler
Return the configuredLoggingHandler
or null.- Returns:
- the configured
LoggingHandler
or null
-
loopResources
Return the configuredLoopResources
or the default.- Returns:
- the configured
LoopResources
or the default
-
metricsRecorder
Return the configured metrics recorderChannelMetricsRecorder
or null.- Returns:
- the configured metrics recorder
ChannelMetricsRecorder
or null
-
options
Return the read-onlyChannelOption
map.- Returns:
- the read-only
ChannelOption
map
-
bindAddress
-
channelType
Return the channel type this configuration is associated with, it can be one of the following.- Parameters:
isDomainSocket
- true ifDomainSocketChannel
orServerDomainSocketChannel
is needed, false otherwise- Returns:
- the channel type this configuration is associated with
-
connectionFactory
protected ChannelFactory<? extends Channel> connectionFactory(EventLoopGroup elg, boolean isDomainSocket) Return theChannelFactory
which is used to createChannel
instances.- Parameters:
elg
- theEventLoopGroup
isDomainSocket
- true ifDomainSocketChannel
orServerDomainSocketChannel
is needed, false otherwise- Returns:
- the
ChannelFactory
which is used to createChannel
instances.
-
defaultConnectionObserver
Return the configured defaultConnectionObserver
.- Returns:
- the configured default
ConnectionObserver
-
defaultLoggingHandler
Return the defaultLoggingHandler
to wiretap this transport.- Returns:
- the default
LoggingHandler
to wiretap this transport
-
defaultLoopResources
Return the defaultLoopResources
for this transport.- Returns:
- the default
LoopResources
for this transport
-
defaultMetricsRecorder
Return the configured metrics recorder.- Returns:
- the configured metrics recorder
-
defaultOnChannelInit
Return the default callback if any orChannelPipelineConfigurer.emptyConfigurer()
.- Returns:
- the default callback if any or
ChannelPipelineConfigurer.emptyConfigurer()
-
eventLoopGroup
Return the configuredEventLoopGroup
.- Returns:
- the configured
EventLoopGroup
-
loggingHandler
-
metricsRecorder
protected void metricsRecorder(@Nullable Supplier<? extends ChannelMetricsRecorder> metricsRecorderSupplier) Obtains immediately theChannelMetricsRecorder
from the providedSupplier
.- Parameters:
metricsRecorderSupplier
- a supplier for theChannelMetricsRecorder
-
metricsRecorderInternal
-
updateMap
Add or remove values to a map in an immutable way by returning a new map instance.- Type Parameters:
K
- key type to addV
- value to add- Parameters:
parentMap
- the container map to updatekey
- the key to updatevalue
- the new value or null to remove an existing key- Returns:
- a new instance of the map
-