Package org.ldaptive.transport.netty
Class StatefulNettyTransport
java.lang.Object
org.ldaptive.transport.netty.StatefulNettyTransport
- All Implemented Interfaces:
Transport
Creates netty connections with configured event loops. This implementation reuses the same event loops for each
connection created. Event loop groups are not shutdown when the connection closed, they can be shared between
multiple connections.
shutdownOnClose controls whether event loop groups are shutdown when the transport is
closed.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Class<? extends io.netty.channel.Channel>Channel type.private final io.netty.channel.EventLoopGroupEvent loop group for I/O, must support the channel type.protected final LoggerLogger for this class.private final io.netty.channel.EventLoopGroupEvent loop group for message handling.private final booleanWhether to shut down the event loop groups onclose(). -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new stateful netty transport.StatefulNettyTransport(int ioThreads) Creates a new stateful netty transport.StatefulNettyTransport(int ioThreads, int messageThreads) Creates a new stateful netty transport.StatefulNettyTransport(Class<? extends io.netty.channel.Channel> type, io.netty.channel.EventLoopGroup ioGroup, io.netty.channel.EventLoopGroup messageGroup, boolean shutdown) Creates a new stateful netty transport.StatefulNettyTransport(String name, int ioThreads, int messageThreads, boolean shutdown) Creates a new stateful netty transport. -
Method Summary
-
Field Details
-
logger
Logger 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 final boolean shutdownOnCloseWhether to shut down the event loop groups onclose().
-
-
Constructor Details
-
StatefulNettyTransport
StatefulNettyTransport()Creates a new stateful netty transport. -
StatefulNettyTransport
StatefulNettyTransport(int ioThreads) Creates a new stateful netty transport.- Parameters:
ioThreads- number of threads used for I/O in the event loop group
-
StatefulNettyTransport
StatefulNettyTransport(int ioThreads, int messageThreads) Creates a new stateful netty transport.- Parameters:
ioThreads- number of threads used for I/O in the event loop groupmessageThreads- number of threads for LDAP message handling in the event loop group
-
StatefulNettyTransport
StatefulNettyTransport(String name, int ioThreads, int messageThreads, boolean shutdown) Creates a new stateful netty transport.- Parameters:
name- to assign the thread poolioThreads- number of threads used for I/O in the event loop groupmessageThreads- number of threads for LDAP message handling in the event loop groupshutdown- whether to shut down the event loop groups on close
-
StatefulNettyTransport
StatefulNettyTransport(Class<? extends io.netty.channel.Channel> type, io.netty.channel.EventLoopGroup ioGroup, io.netty.channel.EventLoopGroup messageGroup, boolean shutdown) Creates a new stateful netty transport.- Parameters:
type- of channelioGroup- event loop group to handle I/OmessageGroup- event loop group to handle inbound messages, can be nullshutdown- whether to shut down the event loop groups on close
-
-
Method Details
-
create
Description copied from interface:TransportCreate a connection object. Implementations should not open a TCP socket in this method. -
close
public void close()Description copied from interface:TransportFree any resources associated with this transport. This method is invoked by the connection factory using this transport. -
shutdown
public void shutdown()Description copied from interface:TransportForce shutdown of this transport. This method is only needed in cases where the connection factory is configured not to close the transport. SeeThreadPoolConfig.setShutdownStrategy(ThreadPoolConfig.ShutdownStrategy). -
getShutdownOnClose
boolean getShutdownOnClose()Returns whether thread pools will be shutdown on close.- Returns:
- whether thread pools will be shutdown on close
-
toString
-