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
ConstructorsModifierConstructorDescriptionprotectedTransportConfig(Map<ChannelOption<?>, ?> options) Default TransportConfig with options.protectedTransportConfig(Map<ChannelOption<?>, ?> options, Supplier<? extends SocketAddress> bindAddress) Default TransportConfig with options.protectedTransportConfig(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 localSocketAddresssupplier that will be bound or null.protected voidbindAddress(Supplier<? extends SocketAddress> bindAddressSupplier) final @Nullable ChannelGroupReturn the configuredChannelGroupor null.intchannelInitializer(ConnectionObserver connectionObserver, @Nullable SocketAddress remoteAddress, boolean onServer) Return theChannelInitializerthat 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 theChannelFactorywhich is used to createChannelinstances.final ConnectionObserverReturn the configuredConnectionObserverif any orConnectionObserver.emptyListener().protected abstract ConnectionObserverReturn the configured defaultConnectionObserver.protected abstract LoggingHandlerReturn the defaultLoggingHandlerto wiretap this transport.protected abstract LoopResourcesReturn the defaultLoopResourcesfor this transport.protected abstract ChannelMetricsRecorderReturn the configured metrics recorder.protected abstract ChannelPipelineConfigurerReturn the default callback if any orChannelPipelineConfigurer.emptyConfigurer().Return the configured callback if any orChannelPipelineConfigurer.emptyConfigurer().protected abstract EventLoopGroupReturn the configuredEventLoopGroup.final booleanReturntrueif prefer native event loop and channel factory (e.g.final @Nullable LoggingHandlerReturn the configuredLoggingHandleror null.protected voidloggingHandler(LoggingHandler loggingHandler) final LoopResourcesReturn the configuredLoopResourcesor the default.final @Nullable Supplier<? extends ChannelMetricsRecorder>Return the configured metrics recorderChannelMetricsRecorderor null.protected voidmetricsRecorder(@Nullable Supplier<? extends ChannelMetricsRecorder> metricsRecorderSupplier) Obtains immediately theChannelMetricsRecorderfrom the providedSupplier.protected @Nullable ChannelMetricsRecorderfinal Map<ChannelOption<?>,?> options()Return the read-onlyChannelOptionmap.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 localSocketAddresssupplier that will be bound or null.- Returns:
- the
SocketAddresssupplier
-
channelHash
public int channelHash() -
channelGroup
Return the configuredChannelGroupor null.- Returns:
- the configured
ChannelGroupor null
-
channelInitializer
public ChannelInitializer<Channel> channelInitializer(ConnectionObserver connectionObserver, @Nullable SocketAddress remoteAddress, boolean onServer) Return theChannelInitializerthat will be used for initializing the channel pipeline.- Parameters:
connectionObserver- the configuredConnectionObserverremoteAddress- the remote addressonServer- channel initializer for the server or for the client- Returns:
- the
ChannelInitializerthat 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 configuredConnectionObserverif any orConnectionObserver.emptyListener().- Returns:
- the configured
ConnectionObserverif 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()Returntrueif prefer native event loop and channel factory (e.g. epoll, io_uring or kqueue).- Returns:
trueif prefer native event loop and channel factory (e.g. epoll, io_uring or kqueue)
-
loggingHandler
Return the configuredLoggingHandleror null.- Returns:
- the configured
LoggingHandleror null
-
loopResources
Return the configuredLoopResourcesor the default.- Returns:
- the configured
LoopResourcesor the default
-
metricsRecorder
Return the configured metrics recorderChannelMetricsRecorderor null.- Returns:
- the configured metrics recorder
ChannelMetricsRecorderor null
-
options
Return the read-onlyChannelOptionmap.- Returns:
- the read-only
ChannelOptionmap
-
bindAddress
-
channelType
Return the channel type this configuration is associated with, it can be one of the following.- Parameters:
isDomainSocket- true ifDomainSocketChannelorServerDomainSocketChannelis needed, false otherwise- Returns:
- the channel type this configuration is associated with
-
connectionFactory
protected ChannelFactory<? extends Channel> connectionFactory(EventLoopGroup elg, boolean isDomainSocket) Return theChannelFactorywhich is used to createChannelinstances.- Parameters:
elg- theEventLoopGroupisDomainSocket- true ifDomainSocketChannelorServerDomainSocketChannelis needed, false otherwise- Returns:
- the
ChannelFactorywhich is used to createChannelinstances.
-
defaultConnectionObserver
Return the configured defaultConnectionObserver.- Returns:
- the configured default
ConnectionObserver
-
defaultLoggingHandler
Return the defaultLoggingHandlerto wiretap this transport.- Returns:
- the default
LoggingHandlerto wiretap this transport
-
defaultLoopResources
Return the defaultLoopResourcesfor this transport.- Returns:
- the default
LoopResourcesfor 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 theChannelMetricsRecorderfrom 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
-