Package com.mongodb.connection.netty
Class NettyStreamFactoryFactory.Builder
- java.lang.Object
-
- com.mongodb.connection.netty.NettyStreamFactoryFactory.Builder
-
- Enclosing class:
- NettyStreamFactoryFactory
public static final class NettyStreamFactoryFactory.Builder extends Object
A builder for an instance ofNettyStreamFactoryFactory
.- Since:
- 3.3
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NettyStreamFactoryFactory.Builder
allocator(io.netty.buffer.ByteBufAllocator allocator)
Sets the allocator.NettyStreamFactoryFactory
build()
Build an instance ofNettyStreamFactoryFactory
.NettyStreamFactoryFactory.Builder
eventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup)
Sets the event loop group.NettyStreamFactoryFactory.Builder
socketChannelClass(Class<? extends io.netty.channel.socket.SocketChannel> socketChannelClass)
Sets the socket channel classNettyStreamFactoryFactory.Builder
sslContext(io.netty.handler.ssl.SslContext sslContext)
Sets a client-sideio.netty.handler.ssl.SslContext
, which overrides the standardSslSettings.getContext()
.
-
-
-
Method Detail
-
allocator
public NettyStreamFactoryFactory.Builder allocator(io.netty.buffer.ByteBufAllocator allocator)
Sets the allocator.- Parameters:
allocator
- the allocator to use for ByteBuf instances- Returns:
- this
-
socketChannelClass
public NettyStreamFactoryFactory.Builder socketChannelClass(Class<? extends io.netty.channel.socket.SocketChannel> socketChannelClass)
Sets the socket channel class- Parameters:
socketChannelClass
- the socket channel class- Returns:
- this
-
eventLoopGroup
public NettyStreamFactoryFactory.Builder eventLoopGroup(io.netty.channel.EventLoopGroup eventLoopGroup)
Sets the event loop group.It is highly recommended to supply your own event loop group and manage its shutdown. Otherwise, the event loop group created by default will not be shutdown properly.
- Parameters:
eventLoopGroup
- the event loop group that all channels created by this factory will be a part of- Returns:
- this
-
sslContext
public NettyStreamFactoryFactory.Builder sslContext(io.netty.handler.ssl.SslContext sslContext)
Sets a client-sideio.netty.handler.ssl.SslContext
, which overrides the standardSslSettings.getContext()
. By default it isnull
andSslSettings.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.OPENSSL
TLS/SSL protocol provider viaSslContextBuilder.sslProvider(SslProvider)
. Note that doing so adds a runtime dependency on netty-tcnative, which you must satisfy.Notes:
- Netty
SslContext
may 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 theSslContextBuilder
and the TLS/SSL protocol provider of choice support it. - Only
SslProvider.JDK
andSslProvider.OPENSSL
TLS/SSL protocol providers are supported.
- Parameters:
sslContext
- The NettySslContext
, which must be created via SslContextBuilder.forClient().- Returns:
this
.- Since:
- 4.3
- Netty
-
build
public NettyStreamFactoryFactory build()
Build an instance ofNettyStreamFactoryFactory
.- Returns:
- factory of the netty stream factory
-
-