Package org.ldaptive.transport.netty
Class DefaultNettyTransport
java.lang.Object
org.ldaptive.transport.netty.DefaultNettyTransport
- All Implemented Interfaces:
Transport
Creates netty connections using the best fit event loop group based on the operating system. See
Epoll.isAvailable() and KQueue.isAvailable(). New event loop
groups are created for every connection. The event loop groups are shutdown when the connection is closed.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new default netty transport.DefaultNettyTransport(int ioThreads) Creates a new default netty transport.DefaultNettyTransport(int ioThreads, int messageThreads) Creates a new default netty transport.DefaultNettyTransport(String name, int ioThreads, int messageThreads) Creates a new default netty transport. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Free any resources associated with this transport.Create a connection object.protected io.netty.channel.EventLoopGroupcreateEventLoopGroup(String name, int numThreads) Returns a new event loop group with the supplied name and number of threads.protected Class<? extends io.netty.channel.Channel>Returns the socket channel type used with the event loop group.voidshutdown()Force shutdown of this transport.toString()
-
Field Details
-
logger
Logger for this class. -
threadPoolName
Name of the event loop group. -
numIoThreads
private final int numIoThreadsNumber of I/O threads. -
numMessageThreads
private final int numMessageThreadsNumber of message threads.
-
-
Constructor Details
-
DefaultNettyTransport
DefaultNettyTransport()Creates a new default netty transport. -
DefaultNettyTransport
DefaultNettyTransport(int ioThreads) Creates a new default netty transport.- Parameters:
ioThreads- number of threads used for I/O in the event loop group
-
DefaultNettyTransport
DefaultNettyTransport(int ioThreads, int messageThreads) Creates a new default 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
-
DefaultNettyTransport
DefaultNettyTransport(String name, int ioThreads, int messageThreads) Creates a new default netty transport.- Parameters:
name- of 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 group
-
-
Method Details
-
getSocketChannelType
Returns the socket channel type used with the event loop group.- Returns:
- socket channel type
-
createEventLoopGroup
Returns a new event loop group with the supplied name and number of threads.- Parameters:
name- of the event loop groupnumThreads- number of worker threads- Returns:
- new event loop group
-
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). -
toString
-