public abstract class TransportConfig extends Object
Modifier | Constructor and Description |
---|---|
protected |
TransportConfig(Map<io.netty.channel.ChannelOption<?>,?> options)
Default TransportConfig with options
|
protected |
TransportConfig(Map<io.netty.channel.ChannelOption<?>,?> options,
Supplier<? extends SocketAddress> bindAddress)
Default TransportConfig with options
|
protected |
TransportConfig(TransportConfig parent)
Create TransportConfig from an existing one
|
Modifier and Type | Method and Description |
---|---|
Map<io.netty.util.AttributeKey<?>,?> |
attributes()
Return the read-only default channel attributes
|
Supplier<? extends SocketAddress> |
bindAddress()
Return the local
SocketAddress supplier that will be bound or null |
io.netty.channel.group.ChannelGroup |
channelGroup()
Return the configured
ChannelGroup or null |
int |
channelHash() |
io.netty.channel.ChannelInitializer<io.netty.channel.Channel> |
channelInitializer(ConnectionObserver connectionObserver,
SocketAddress remoteAddress,
boolean onServer)
Return the
ChannelInitializer that will be used for initializing the channel pipeline |
ChannelOperations.OnSetup |
channelOperationsProvider()
Return the associated
ChannelOperations.OnSetup , config implementations might override this |
protected abstract Class<? extends io.netty.channel.Channel> |
channelType(boolean isDomainSocket)
Return the channel type this configuration is associated with, it can be one of the following:
SocketChannel
ServerSocketChannel
DomainSocketChannel
ServerDomainSocketChannel
DatagramChannel
|
protected io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> |
connectionFactory(io.netty.channel.EventLoopGroup elg,
boolean isDomainSocket)
Return the
ChannelFactory which is used to create Channel instances. |
ConnectionObserver |
connectionObserver()
Return the configured
ConnectionObserver if any or ConnectionObserver.emptyListener() |
protected abstract ConnectionObserver |
defaultConnectionObserver()
Return the configured default
ConnectionObserver . |
protected abstract io.netty.handler.logging.LoggingHandler |
defaultLoggingHandler()
Return the default
LoggingHandler to wiretap this transport |
protected abstract LoopResources |
defaultLoopResources()
Return the default
LoopResources for this transport |
protected abstract ChannelMetricsRecorder |
defaultMetricsRecorder()
Return the configured metrics recorder.
|
protected abstract ChannelPipelineConfigurer |
defaultOnChannelInit()
Return the default callback if any or
ChannelPipelineConfigurer.emptyConfigurer() |
ChannelPipelineConfigurer |
doOnChannelInit()
Return the configured callback if any or
ChannelPipelineConfigurer.emptyConfigurer() |
protected abstract io.netty.channel.EventLoopGroup |
eventLoopGroup()
Return the configured
EventLoopGroup . |
boolean |
isPreferNative()
Return
true if prefer native event loop and channel factory (e.g. |
io.netty.handler.logging.LoggingHandler |
loggingHandler()
Return the configured
LoggingHandler or null |
protected void |
loggingHandler(io.netty.handler.logging.LoggingHandler loggingHandler) |
LoopResources |
loopResources()
Return the configured
LoopResources or the default |
Supplier<? extends ChannelMetricsRecorder> |
metricsRecorder()
Return the configured metrics recorder
ChannelMetricsRecorder or null |
protected void |
metricsRecorder(Supplier<? extends ChannelMetricsRecorder> metricsRecorderSupplier)
Obtains immediately the
ChannelMetricsRecorder from the provided Supplier |
protected ChannelMetricsRecorder |
metricsRecorderInternal() |
Map<io.netty.channel.ChannelOption<?>,?> |
options()
Return the read-only
ChannelOption map |
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.
|
protected TransportConfig(Map<io.netty.channel.ChannelOption<?>,?> options)
protected TransportConfig(Map<io.netty.channel.ChannelOption<?>,?> options, Supplier<? extends SocketAddress> bindAddress)
protected TransportConfig(TransportConfig parent)
public final Map<io.netty.util.AttributeKey<?>,?> attributes()
@Nullable public final Supplier<? extends SocketAddress> bindAddress()
SocketAddress
supplier that will be bound or nullSocketAddress
supplierpublic int channelHash()
@Nullable public final io.netty.channel.group.ChannelGroup channelGroup()
ChannelGroup
or nullChannelGroup
or nullpublic final io.netty.channel.ChannelInitializer<io.netty.channel.Channel> channelInitializer(ConnectionObserver connectionObserver, @Nullable SocketAddress remoteAddress, boolean onServer)
ChannelInitializer
that will be used for initializing the channel pipelineconnectionObserver
- the configured ConnectionObserver
remoteAddress
- the remote addressonServer
- channel initializer for the server or for the clientChannelInitializer
that will be used for initializing the channel pipelinepublic ChannelOperations.OnSetup channelOperationsProvider()
ChannelOperations.OnSetup
, config implementations might override thisChannelOperations.OnSetup
public final ConnectionObserver connectionObserver()
ConnectionObserver
if any or ConnectionObserver.emptyListener()
ConnectionObserver
if any or ConnectionObserver.emptyListener()
public final ChannelPipelineConfigurer doOnChannelInit()
ChannelPipelineConfigurer.emptyConfigurer()
ChannelPipelineConfigurer.emptyConfigurer()
public final boolean isPreferNative()
true
if prefer native event loop and channel factory (e.g. epoll or kqueue)true
if prefer native event loop and channel factory (e.g. epoll or kqueue)@Nullable public final io.netty.handler.logging.LoggingHandler loggingHandler()
LoggingHandler
or nullLoggingHandler
or nullpublic final LoopResources loopResources()
LoopResources
or the defaultLoopResources
or the default@Nullable public final Supplier<? extends ChannelMetricsRecorder> metricsRecorder()
ChannelMetricsRecorder
or nullChannelMetricsRecorder
or nullpublic final Map<io.netty.channel.ChannelOption<?>,?> options()
ChannelOption
mapChannelOption
mapprotected abstract Class<? extends io.netty.channel.Channel> channelType(boolean isDomainSocket)
SocketChannel
ServerSocketChannel
DomainSocketChannel
ServerDomainSocketChannel
DatagramChannel
isDomainSocket
- true if DomainSocketChannel
or
ServerDomainSocketChannel
is needed, false otherwiseprotected io.netty.channel.ChannelFactory<? extends io.netty.channel.Channel> connectionFactory(io.netty.channel.EventLoopGroup elg, boolean isDomainSocket)
ChannelFactory
which is used to create Channel
instances.elg
- the EventLoopGroup
isDomainSocket
- true if DomainSocketChannel
or
ServerDomainSocketChannel
is needed, false otherwiseChannelFactory
which is used to create Channel
instances.protected abstract ConnectionObserver defaultConnectionObserver()
ConnectionObserver
.ConnectionObserver
protected abstract io.netty.handler.logging.LoggingHandler defaultLoggingHandler()
LoggingHandler
to wiretap this transportLoggingHandler
to wiretap this transportprotected abstract LoopResources defaultLoopResources()
LoopResources
for this transportLoopResources
for this transportprotected abstract ChannelMetricsRecorder defaultMetricsRecorder()
protected abstract ChannelPipelineConfigurer defaultOnChannelInit()
ChannelPipelineConfigurer.emptyConfigurer()
ChannelPipelineConfigurer.emptyConfigurer()
protected abstract io.netty.channel.EventLoopGroup eventLoopGroup()
EventLoopGroup
.EventLoopGroup
protected void loggingHandler(io.netty.handler.logging.LoggingHandler loggingHandler)
protected void metricsRecorder(@Nullable Supplier<? extends ChannelMetricsRecorder> metricsRecorderSupplier)
ChannelMetricsRecorder
from the provided Supplier
metricsRecorderSupplier
- a supplier for the ChannelMetricsRecorder
protected ChannelMetricsRecorder metricsRecorderInternal()
protected static <K,V> Map<K,V> updateMap(Map<K,V> parentMap, Object key, @Nullable Object value)
K
- key type to addV
- value to addparentMap
- the container map to updatekey
- the key to updatevalue
- the new value or null to remove an existing key