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
public class NettyConnectionFactoryTransport extends Object implements Transport
Creates netty connections with configured event loops. This implementation reuses the same event loops for each connection created.
-
-
Field Summary
Fields Modifier and Type Field Description private Class<? extends io.netty.channel.Channel>
channelType
Channel type.private io.netty.channel.EventLoopGroup
ioWorkerGroup
Event loop group for I/O, must support the channel type.protected Logger
logger
Logger for this class.private io.netty.channel.EventLoopGroup
messageWorkerGroup
Event loop group for message handling.private boolean
shutdownOnClose
Whether to shut down the event loop groups onclose()
.
-
Constructor Summary
Constructors Constructor Description NettyConnectionFactoryTransport(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Free any resources associated with this transport.Connection
create(ConnectionConfig cc)
Create a connection object.void
setShutdownOnClose(boolean b)
Sets whether to shut down the event loop groups on close.String
toString()
-
-
-
Field Detail
-
logger
protected final Logger logger
Logger for this class.
-
channelType
private final Class<? extends io.netty.channel.Channel> channelType
Channel type.
-
ioWorkerGroup
private final io.netty.channel.EventLoopGroup ioWorkerGroup
Event loop group for I/O, must support the channel type.
-
messageWorkerGroup
private final io.netty.channel.EventLoopGroup messageWorkerGroup
Event loop group for message handling.
-
shutdownOnClose
private boolean shutdownOnClose
Whether to shut down the event loop groups onclose()
.
-
-
Constructor Detail
-
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 Detail
-
setShutdownOnClose
public void setShutdownOnClose(boolean b)
Sets whether to shut down the event loop groups on close.- Parameters:
b
- whether to shut down on close
-
create
public Connection create(ConnectionConfig cc)
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.
-
-