Class AbstractBootstrap<B extends AbstractBootstrap<B,C> , C extends Channel >
java.lang.Object
io.netty.bootstrap.AbstractBootstrap<B,C>
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
Bootstrap, ServerBootstrap
public abstract class AbstractBootstrap<B extends AbstractBootstrap<B,C>, C extends Channel>
extends Object
implements Cloneable
AbstractBootstrap is a helper class that makes it easy to bootstrap a Channel. It support
method-chaining to provide an easy way to configure the AbstractBootstrap.
When not used in a ServerBootstrap context, the bind() methods are useful for connectionless
transports such as datagram (UDP).
-
Method Summary
Modifier and TypeMethodDescription<T> Battr(AttributeKey<T> key, T value) Allow to specify an initial attribute of the newly createdChannel.bind()Create a newChanneland bind it.bind(int inetPort) Create a newChanneland bind it.Create a newChanneland bind it.bind(InetAddress inetHost, int inetPort) Create a newChanneland bind it.bind(SocketAddress localAddress) Create a newChanneland bind it.channelFactory(ChannelFactory<? extends C> channelFactory) Deprecated.UsechannelFactory(io.netty.channel.ChannelFactory)instead.channelFactory(ChannelFactory<? extends C> channelFactory) abstract Bclone()Returns a deep clone of this bootstrap which has the identical configuration.abstract AbstractBootstrapConfig<B, C> config()Returns theAbstractBootstrapConfigobject that can be used to obtain the current config of the bootstrap.extensionsClassLoader(ClassLoader classLoader) LoadChannelInitializerExtensions using the given class loader.final EventLoopGroupgroup()Deprecated.Useconfig()instead.group(EventLoopGroup group) TheEventLoopGroupwhich is used to handle all the events for the to-be-createdChannelhandler(ChannelHandler handler) theChannelHandlerto use for serving the requests.localAddress(int inetPort) localAddress(String inetHost, int inetPort) localAddress(InetAddress inetHost, int inetPort) localAddress(SocketAddress localAddress) TheSocketAddresswhich is used to bind the local "end" to.<T> Boption(ChannelOption<T> option, T value) Allow to specify aChannelOptionwhich is used for theChannelinstances once they got created.register()toString()validate()Validate all the parameters.
-
Method Details
-
group
TheEventLoopGroupwhich is used to handle all the events for the to-be-createdChannel -
channel
-
channelFactory
Deprecated.UsechannelFactory(io.netty.channel.ChannelFactory)instead. -
channelFactory
ChannelFactorywhich is used to createChannelinstances from when callingbind(). This method is usually only used ifchannel(Class)is not working for you because of some more complex needs. If yourChannelimplementation has a no-args constructor, its highly recommend to just usechannel(Class)to simplify your code. -
localAddress
TheSocketAddresswhich is used to bind the local "end" to. -
localAddress
- See Also:
-
localAddress
- See Also:
-
localAddress
- See Also:
-
option
Allow to specify aChannelOptionwhich is used for theChannelinstances once they got created. Use a value ofnullto remove a previous setChannelOption. -
attr
Allow to specify an initial attribute of the newly createdChannel. If thevalueisnull, the attribute of the specifiedkeyis removed. -
extensionsClassLoader
LoadChannelInitializerExtensions using the given class loader.By default, the extensions will be loaded by the same class loader that loaded this bootstrap class.
- Parameters:
classLoader- The class loader to use for loadingChannelInitializerExtensions.- Returns:
- This bootstrap.
-
validate
Validate all the parameters. Sub-classes may override this, but should call the super method in that case. -
clone
Returns a deep clone of this bootstrap which has the identical configuration. This method is useful when making multipleChannels with similar settings. Please note that this method does not clone theEventLoopGroupdeeply but shallowly, making the group a shared resource. -
register
-
bind
Create a newChanneland bind it. -
bind
Create a newChanneland bind it. -
bind
Create a newChanneland bind it. -
bind
Create a newChanneland bind it. -
bind
Create a newChanneland bind it. -
handler
theChannelHandlerto use for serving the requests. -
group
Deprecated.Useconfig()instead.Returns the configuredEventLoopGroupornullif non is configured yet. -
config
Returns theAbstractBootstrapConfigobject that can be used to obtain the current config of the bootstrap. -
toString
-