Top Description Inners Fields Constructors Methods
reactor.netty.transport

public abstract Class TransportConfig

extends Object
Class Inheritance
Known Direct Subclasses
reactor.netty.udp.UdpServerConfig, reactor.netty.transport.ClientTransportConfig, reactor.netty.transport.ServerTransportConfig
Imports
java.net.SocketAddress, java.util.Collections, .HashMap, .Map, .Objects, java.util.function.Supplier, io.netty.buffer.ByteBufAllocator, .PooledByteBufAllocator, .UnpooledByteBufAllocator, io.netty.channel.Channel, .ChannelFactory, .ChannelInitializer, .ChannelOption, .ChannelPipeline, .EventLoopGroup, io.netty.channel.group.ChannelGroup, io.netty.handler.logging.LoggingHandler, io.netty.util.AttributeKey, reactor.netty.ChannelPipelineConfigurer, .ConnectionObserver, .NettyPipeline, reactor.netty.channel.ChannelMetricsRecorder, .ChannelOperations, reactor.netty.internal.util.MapUtils, .Metrics, reactor.netty.resources.LoopResources, reactor.util.Logger, .Loggers, reactor.util.annotation.Nullable

A basic configuration holder. The public API is read-only.
Authors
Stephane Maldini, Violeta Georgieva
Since
1.0.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv Map<AttributeKey<?>, ?>
pack-priv Supplier<? extends SocketAddress>
pack-priv ChannelGroup
pack-priv ChannelPipelineConfigurer
pack-priv static final Logger
pack-priv LoggingHandler
pack-priv LoopResources
pack-priv ChannelMetricsRecorder
pack-priv ConnectionObserver
pack-priv Map<ChannelOption<?>, ?>
pack-priv boolean

Constructor Summary

AccessConstructor and Description
protected
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 TypeMethod and Description
public final Map<AttributeKey<?>, ?>

Returns:

the read-only default channel attributes
attributes
()

Return the read-only default channel attributes.

public final Supplier<? extends SocketAddress>

Returns:

the SocketAddress supplier
bindAddress
()

Return the local SocketAddress supplier that will be bound or null.

public final ChannelGroup

Returns:

the configured ChannelGroup or null
channelGroup
()

Return the configured ChannelGroup or null.

public int
public final ChannelInitializer<Channel>

Returns:

the ChannelInitializer that will be used for initializing the channel pipeline
channelInitializer
(ConnectionObserver
the configured ConnectionObserver
connectionObserver
,
SocketAddress
the remote address
remoteAddress
,
boolean
channel initializer for the server or for the client
onServer
)

Return the ChannelInitializer that will be used for initializing the channel pipeline.

public ChannelOperations.OnSetup

Returns:

the associated ChannelOperations.OnSetup
channelOperationsProvider
()

Return the associated ChannelOperations.OnSetup, config implementations might override this.

protected abstract Class<? extends Channel>

Returns:

the channel type this configuration is associated with
channelType
(boolean isDomainSocket)

Return the channel type this configuration is associated with, it can be one of the following.

protected ChannelFactory<? extends Channel>

Returns:

the ChannelFactory which is used to create Channel instances.
connectionFactory
(EventLoopGroup elg, boolean isDomainSocket)

Deprecated as a consequence of ChannelFactory being deprecated.
Return the ChannelFactory which is used to create Channel instances.
public final ConnectionObserver
protected abstract ConnectionObserver

Returns:

the configured default ConnectionObserver
defaultConnectionObserver
()

Return the configured default ConnectionObserver.

protected abstract LoggingHandler

Returns:

the default LoggingHandler to wiretap this transport
defaultLoggingHandler
()

Return the default LoggingHandler to wiretap this transport.

protected abstract LoopResources

Returns:

the default LoopResources for this transport
defaultLoopResources
()

Return the default LoopResources for this transport.

protected abstract ChannelMetricsRecorder

Returns:

the configured metrics recorder
defaultMetricsRecorder
()

Return the configured metrics recorder.

protected abstract ChannelPipelineConfigurer

Returns:

the default callback if any or ChannelPipelineConfigurer#emptyConfigurer()
defaultOnChannelInit
()

Return the default callback if any or ChannelPipelineConfigurer#emptyConfigurer().

public final ChannelPipelineConfigurer

Returns:

the configured callback if any or ChannelPipelineConfigurer#emptyConfigurer()
doOnChannelInit
()

Return the configured callback if any or ChannelPipelineConfigurer#emptyConfigurer().

protected abstract EventLoopGroup

Returns:

the configured EventLoopGroup
eventLoopGroup
()

Return the configured EventLoopGroup.

public final boolean

Returns:

true if prefer native event loop and channel factory (e.g. epoll or kqueue)
isPreferNative
()

Return true if prefer native event loop and channel factory (e.g. epoll or kqueue).

public final LoggingHandler

Returns:

the configured LoggingHandler or null
loggingHandler
()

Return the configured LoggingHandler or null.

protected void
public final LoopResources

Returns:

the configured LoopResources or the default
loopResources
()

Return the configured LoopResources or the default.

public final Supplier<? extends ChannelMetricsRecorder>

Returns:

the configured metrics recorder ChannelMetricsRecorder or null
metricsRecorder
()

Return the configured metrics recorder ChannelMetricsRecorder or null.

protected void
metricsRecorder(Supplier<? extends ChannelMetricsRecorder>
a supplier for the ChannelMetricsRecorder
metricsRecorderSupplier
)

Obtains immediately the ChannelMetricsRecorder from the provided Supplier.

protected ChannelMetricsRecorder
public final Map<ChannelOption<?>, ?>

Returns:

the read-only ChannelOption map
options
()

Return the read-only ChannelOption map.

protected static <
key type to add
K
,
value to add
V
>
Map<K, V>

Returns:

a new instance of the map
updateMap
(Map<K, V>
the container map to update
parentMap
,
Object
the key to update
key
,
Object
the new value or null to remove an existing key
value
)

Add or remove values to a map in an immutable way by returning a new map instance.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attrsback to summary
pack-priv Map<AttributeKey<?>, ?> attrs
bindAddressback to summary
pack-priv Supplier<? extends SocketAddress> bindAddress
channelGroupback to summary
pack-priv ChannelGroup channelGroup
doOnChannelInitback to summary
pack-priv ChannelPipelineConfigurer doOnChannelInit
logback to summary
pack-priv static final Logger log
loggingHandlerback to summary
pack-priv LoggingHandler loggingHandler
loopResourcesback to summary
pack-priv LoopResources loopResources
metricsRecorderback to summary
pack-priv ChannelMetricsRecorder metricsRecorder
observerback to summary
pack-priv ConnectionObserver observer
optionsback to summary
pack-priv Map<ChannelOption<?>, ?> options
preferNativeback to summary
pack-priv boolean preferNative

Constructor Detail

TransportConfigback to summary
protected TransportConfig(Map<ChannelOption<?>, ?> options)

Default TransportConfig with options.

TransportConfigback to summary
protected TransportConfig(Map<ChannelOption<?>, ?> options, Supplier<? extends SocketAddress> bindAddress)

Default TransportConfig with options.

TransportConfigback to summary
protected TransportConfig(TransportConfig parent)

Create TransportConfig from an existing one.

Method Detail

attributesback to summary
public final Map<AttributeKey<?>, ?> attributes()

Return the read-only default channel attributes.

Returns:Map<AttributeKey<?>, ?>

the read-only default channel attributes

bindAddressback to summary
public final Supplier<? extends SocketAddress> bindAddress()

Return the local SocketAddress supplier that will be bound or null.

Returns:Supplier<? extends SocketAddress>

the SocketAddress supplier

Annotations
@Nullable
channelGroupback to summary
public final ChannelGroup channelGroup()

Return the configured ChannelGroup or null.

Returns:ChannelGroup

the configured ChannelGroup or null

Annotations
@Nullable
channelHashback to summary
public int channelHash()
channelInitializerback to summary
public final ChannelInitializer<Channel> channelInitializer(ConnectionObserver connectionObserver, SocketAddress remoteAddress, boolean onServer)

Return the ChannelInitializer that will be used for initializing the channel pipeline.

Parameters
connectionObserver:ConnectionObserver

the configured ConnectionObserver

remoteAddress:SocketAddress

the remote address

onServer:boolean

channel initializer for the server or for the client

Returns:ChannelInitializer<Channel>

the ChannelInitializer that will be used for initializing the channel pipeline

channelOperationsProviderback to summary
public ChannelOperations.OnSetup channelOperationsProvider()

Return the associated ChannelOperations.OnSetup, config implementations might override this.

Returns:ChannelOperations.OnSetup

the associated ChannelOperations.OnSetup

channelTypeback to summary
protected abstract Class<? extends Channel> channelType(boolean isDomainSocket)

Return the channel type this configuration is associated with, it can be one of the following.

Parameters
isDomainSocket:boolean

true if io.netty.channel.unix.DomainSocketChannel or io.netty.channel.unix.ServerDomainSocketChannel is needed, false otherwise

Returns:Class<? extends Channel>

the channel type this configuration is associated with

connectionFactoryback to summary
protected ChannelFactory<? extends Channel> connectionFactory(EventLoopGroup elg, boolean isDomainSocket)

Deprecated

as a consequence of ChannelFactory being deprecated. See corresponding docs for further information.

Return the ChannelFactory which is used to create Channel instances.

Parameters
elg:EventLoopGroup

the EventLoopGroup

isDomainSocket:boolean

true if io.netty.channel.unix.DomainSocketChannel or io.netty.channel.unix.ServerDomainSocketChannel is needed, false otherwise

Returns:ChannelFactory<? extends Channel>

the ChannelFactory which is used to create Channel instances.

connectionObserverback to summary
public final ConnectionObserver connectionObserver()

Return the configured ConnectionObserver if any or ConnectionObserver#emptyListener().

Returns:ConnectionObserver

the configured ConnectionObserver if any or ConnectionObserver#emptyListener()

defaultConnectionObserverback to summary
protected abstract ConnectionObserver defaultConnectionObserver()

Return the configured default ConnectionObserver.

Returns:ConnectionObserver

the configured default ConnectionObserver

defaultLoggingHandlerback to summary
protected abstract LoggingHandler defaultLoggingHandler()

Return the default LoggingHandler to wiretap this transport.

Returns:LoggingHandler

the default LoggingHandler to wiretap this transport

defaultLoopResourcesback to summary
protected abstract LoopResources defaultLoopResources()

Return the default LoopResources for this transport.

Returns:LoopResources

the default LoopResources for this transport

defaultMetricsRecorderback to summary
protected abstract ChannelMetricsRecorder defaultMetricsRecorder()

Return the configured metrics recorder.

Returns:ChannelMetricsRecorder

the configured metrics recorder

defaultOnChannelInitback to summary
protected abstract ChannelPipelineConfigurer defaultOnChannelInit()

Return the default callback if any or ChannelPipelineConfigurer#emptyConfigurer().

Returns:ChannelPipelineConfigurer

the default callback if any or ChannelPipelineConfigurer#emptyConfigurer()

doOnChannelInitback to summary
public final ChannelPipelineConfigurer doOnChannelInit()

Return the configured callback if any or ChannelPipelineConfigurer#emptyConfigurer().

Returns:ChannelPipelineConfigurer

the configured callback if any or ChannelPipelineConfigurer#emptyConfigurer()

eventLoopGroupback to summary
protected abstract EventLoopGroup eventLoopGroup()

Return the configured EventLoopGroup.

Returns:EventLoopGroup

the configured EventLoopGroup

isPreferNativeback to summary
public final boolean isPreferNative()

Return true if prefer native event loop and channel factory (e.g. epoll or kqueue).

Returns:boolean

true if prefer native event loop and channel factory (e.g. epoll or kqueue)

loggingHandlerback to summary
public final LoggingHandler loggingHandler()

Return the configured LoggingHandler or null.

Returns:LoggingHandler

the configured LoggingHandler or null

Annotations
@Nullable
loggingHandlerback to summary
protected void loggingHandler(LoggingHandler loggingHandler)
loopResourcesback to summary
public final LoopResources loopResources()

Return the configured LoopResources or the default.

Returns:LoopResources

the configured LoopResources or the default

metricsRecorderback to summary
public final Supplier<? extends ChannelMetricsRecorder> metricsRecorder()

Return the configured metrics recorder ChannelMetricsRecorder or null.

Returns:Supplier<? extends ChannelMetricsRecorder>

the configured metrics recorder ChannelMetricsRecorder or null

Annotations
@Nullable
metricsRecorderback to summary
protected void metricsRecorder(Supplier<? extends ChannelMetricsRecorder> metricsRecorderSupplier)

Obtains immediately the ChannelMetricsRecorder from the provided Supplier.

Parameters
metricsRecorderSupplier:Supplier<? extends ChannelMetricsRecorder>

a supplier for the ChannelMetricsRecorder

metricsRecorderInternalback to summary
protected ChannelMetricsRecorder metricsRecorderInternal()
optionsback to summary
public final Map<ChannelOption<?>, ?> options()

Return the read-only ChannelOption map.

Returns:Map<ChannelOption<?>, ?>

the read-only ChannelOption map

updateMapback to summary
protected static <K, V> Map<K, V> updateMap(Map<K, V> parentMap, Object key, Object value)

Add or remove values to a map in an immutable way by returning a new map instance.

Parameters
<K>
key type to add
<V>
value to add
parentMap:Map<K, V>

the container map to update

key:Object

the key to update

value:Object

the new value or null to remove an existing key

Returns:Map<K, V>

a new instance of the map

Annotations
@SuppressWarnings:unchecked
reactor.netty.transport back to summary

pack-priv final Class TransportConfig.TransportChannelInitializer

extends ChannelInitializer<Channel>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final TransportConfig
pack-priv final ConnectionObserver
pack-priv final boolean
pack-priv final SocketAddress

Constructor Summary

AccessConstructor and Description
pack-priv
TransportChannelInitializer(TransportConfig config, ConnectionObserver connectionObserver, SocketAddress remoteAddress, boolean onServer)

Method Summary

Modifier and TypeMethod and Description
protected void
initChannel(Channel
the Channel which was registered.
channel
)

Implements abstract io.netty.channel.ChannelInitializer.initChannel.

This method will be called once the Channel was registered.
Inherited from io.netty.channel.ChannelInitializer:
channelRegisteredexceptionCaughthandlerAddedhandlerRemoved

Field Detail

configback to summary
pack-priv final TransportConfig config
connectionObserverback to summary
pack-priv final ConnectionObserver connectionObserver
onServerback to summary
pack-priv final boolean onServer
remoteAddressback to summary
pack-priv final SocketAddress remoteAddress

Constructor Detail

TransportChannelInitializerback to summary
pack-priv TransportChannelInitializer(TransportConfig config, ConnectionObserver connectionObserver, SocketAddress remoteAddress, boolean onServer)

Method Detail

initChannelback to summary
protected void initChannel(Channel channel)

Implements abstract io.netty.channel.ChannelInitializer.initChannel.

Doc from io.netty.channel.ChannelInitializer.initChannel.

This method will be called once the Channel was registered. After the method returns this instance will be removed from the ChannelPipeline of the Channel.

Parameters
channel:Channel

the Channel which was registered.

Annotations
@Override