Package org.ldaptive.transport.netty
Class NettyConnectionFactoryTransport
java.lang.Object
org.ldaptive.transport.netty.NettyConnectionFactoryTransport
- All Implemented Interfaces:
Transport
- Direct Known Subclasses:
ConnectionFactoryTransport
,NioConnectionFactoryTransport
,NioSingletonTransport
,SingletonTransport
Creates netty connections with configured event loops. This implementation reuses the same event loops for each
connection created.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Class<? extends io.netty.channel.Channel>
Channel type.private final io.netty.channel.EventLoopGroup
Event loop group for I/O, must support the channel type.protected final org.slf4j.Logger
Logger for this class.private final io.netty.channel.EventLoopGroup
Event loop group for message handling.private boolean
Whether to shutdown the event loop groups onclose()
. -
Constructor Summary
ConstructorsConstructorDescriptionNettyConnectionFactoryTransport
(Class<? extends io.netty.channel.Channel> type, io.netty.channel.EventLoopGroup ioGroup) Creates a new netty connection factory transport.NettyConnectionFactoryTransport
(Class<? extends io.netty.channel.Channel> type, io.netty.channel.EventLoopGroup ioGroup, io.netty.channel.EventLoopGroup messageGroup) Creates a new netty connection factory transport. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Free any resources associated with this transport.Create a connection object.void
setShutdownOnClose
(boolean b) Sets whether to shutdown the event loop groups on close.toString()
-
Field Details
-
logger
protected final org.slf4j.Logger loggerLogger for this class. -
channelType
Channel type. -
ioWorkerGroup
private final io.netty.channel.EventLoopGroup ioWorkerGroupEvent loop group for I/O, must support the channel type. -
messageWorkerGroup
private final io.netty.channel.EventLoopGroup messageWorkerGroupEvent loop group for message handling. -
shutdownOnClose
private boolean shutdownOnCloseWhether to shutdown the event loop groups onclose()
.
-
-
Constructor Details
-
NettyConnectionFactoryTransport
public NettyConnectionFactoryTransport(Class<? extends io.netty.channel.Channel> type, io.netty.channel.EventLoopGroup ioGroup) Creates a new netty connection factory transport.- Parameters:
type
- of channelioGroup
- event loop group to handle I/O
-
NettyConnectionFactoryTransport
public NettyConnectionFactoryTransport(Class<? extends io.netty.channel.Channel> type, io.netty.channel.EventLoopGroup ioGroup, io.netty.channel.EventLoopGroup messageGroup) Creates a new netty connection factory transport.- Parameters:
type
- of channelioGroup
- event loop group to handle I/OmessageGroup
- event loop group to handle inbound messages, can be null
-
-
Method Details
-
setShutdownOnClose
public void setShutdownOnClose(boolean b) Sets whether to shutdown the event loop groups on close.- Parameters:
b
- whether to shutdown on close
-
create
Description copied from interface:Transport
Create a connection object. Implementations should not open a TCP socket in this method. -
close
public void close()Description copied from interface:Transport
Free any resources associated with this transport. -
toString
-