Package com.mongodb.connection
Class NettyTransportSettings.Builder
java.lang.Object
com.mongodb.connection.NettyTransportSettings.Builder
- Enclosing class:
- NettyTransportSettings
A builder for an instance of
NettyTransportSettings.-
Method Summary
Modifier and TypeMethodDescriptionallocator(io.netty.buffer.ByteBufAllocator allocator) Sets the allocator.build()Build an instance ofNettyTransportSettings.eventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup) Sets the event loop group.socketChannelClass(Class<? extends io.netty.channel.socket.SocketChannel> socketChannelClass) Sets the socket channel classsslContext(io.netty.handler.ssl.SslContext sslContext) Sets a client-sideio.netty.handler.ssl.SslContext, which overrides the standardSslSettings.getContext().
-
Method Details
-
allocator
Sets the allocator.- Parameters:
allocator- the allocator to use for ByteBuf instances- Returns:
- this
- See Also:
-
socketChannelClass
public NettyTransportSettings.Builder socketChannelClass(Class<? extends io.netty.channel.socket.SocketChannel> socketChannelClass) Sets the socket channel class- Parameters:
socketChannelClass- the socket channel class- Returns:
- this
- See Also:
-
eventLoopGroup
public NettyTransportSettings.Builder eventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup) Sets the event loop group.The application is responsible for shutting down the provided
eventLoopGroup- Parameters:
eventLoopGroup- the event loop group that all channels created by this factory will be a part of- Returns:
- this
- See Also:
-
sslContext
Sets a client-sideio.netty.handler.ssl.SslContext, which overrides the standardSslSettings.getContext(). By default, it isnullandSslSettings.getContext()is at play.This option may be used as a convenient way to utilize OpenSSL as an alternative to the TLS/SSL protocol implementation in a JDK. To achieve this, specify
SslProvider.OPENSSLTLS/SSL protocol provider viaSslContextBuilder.sslProvider(SslProvider). Note that doing so adds a runtime dependency on netty-tcnative, which you must satisfy.Notes:
- Netty
SslContextmay not examine some security/system properties that are used to customize JSSE. Therefore, instead of using them you may have to apply the equivalent configuration programmatically, if both theSslContextBuilderand the TLS/SSL protocol provider of choice support it. - Only
SslProvider.JDKandSslProvider.OPENSSLTLS/SSL protocol providers are supported.
- Parameters:
sslContext- The NettySslContext, which must be created via SslContextBuilder.forClient().- Returns:
this.- See Also:
- Netty
-
build
Build an instance ofNettyTransportSettings.- Returns:
- factory for
NettyTransportSettings
-