public abstract class TransportConfig extends Object
Modifier | Constructor 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.
|
Modifier and Type | Method and Description |
---|---|
Map<AttributeKey<?>,?> |
attributes()
Return the read-only default channel attributes.
|
Supplier<? extends SocketAddress> |
bindAddress()
Return the local
SocketAddress supplier that will be bound or null. |
ChannelGroup |
channelGroup()
Return the configured
ChannelGroup or null. |
int |
channelHash() |
ChannelInitializer<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 Channel> |
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 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 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 EventLoopGroup |
eventLoopGroup()
Return the configured
EventLoopGroup . |
boolean |
isPreferNative()
Return
true if prefer native event loop and channel factory (e.g. |
LoggingHandler |
loggingHandler()
Return the configured
LoggingHandler or null. |
protected void |
loggingHandler(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<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<ChannelOption<?>,?> options)
protected TransportConfig(Map<ChannelOption<?>,?> options, Supplier<? extends SocketAddress> bindAddress)
protected TransportConfig(TransportConfig parent)
public final Map<AttributeKey<?>,?> attributes()
@Nullable public final Supplier<? extends SocketAddress> bindAddress()
SocketAddress
supplier that will be bound or null.SocketAddress
supplierpublic int channelHash()
@Nullable public final ChannelGroup channelGroup()
ChannelGroup
or null.ChannelGroup
or nullpublic final ChannelInitializer<Channel> channelInitializer(ConnectionObserver connectionObserver, @Nullable SocketAddress remoteAddress, boolean onServer)
ChannelInitializer
that will be used for initializing the channel pipeline.connectionObserver
- 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 this.ChannelOperations.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 LoggingHandler loggingHandler()
LoggingHandler
or null.LoggingHandler
or nullpublic final LoopResources loopResources()
LoopResources
or the default.LoopResources
or the default@Nullable public final Supplier<? extends ChannelMetricsRecorder> metricsRecorder()
ChannelMetricsRecorder
or null.ChannelMetricsRecorder
or nullpublic final Map<ChannelOption<?>,?> options()
ChannelOption
map.ChannelOption
mapprotected abstract Class<? extends Channel> channelType(boolean isDomainSocket)
isDomainSocket
- true if DomainSocketChannel
or
ServerDomainSocketChannel
is needed, false otherwiseprotected ChannelFactory<? extends Channel> connectionFactory(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 LoggingHandler defaultLoggingHandler()
LoggingHandler
to wiretap this transport.LoggingHandler
to wiretap this transportprotected abstract LoopResources defaultLoopResources()
LoopResources
for this transport.LoopResources
for this transportprotected abstract ChannelMetricsRecorder defaultMetricsRecorder()
protected abstract ChannelPipelineConfigurer defaultOnChannelInit()
ChannelPipelineConfigurer.emptyConfigurer()
.ChannelPipelineConfigurer.emptyConfigurer()
protected abstract EventLoopGroup eventLoopGroup()
EventLoopGroup
.EventLoopGroup
protected void loggingHandler(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