Package org.ldaptive.transport
Class ThreadPoolConfig
java.lang.Object
org.ldaptive.AbstractFreezable
org.ldaptive.AbstractConfig
org.ldaptive.transport.ThreadPoolConfig
- All Implemented Interfaces:
Freezable
Contains configuration properties for creating thread pools used by transports.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic enumEnum to describe how thread pools should be shutdown. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intNumber of I/O threads. 0 uses the default number of threads.private intNumber of message threads. 0 uses the default number of threadsThread pool shutdown strategy.private StringName of the thread pool.Fields inherited from class org.ldaptive.AbstractConfig
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadPoolConfig.Builderbuilder()Creates a builder for this class.static ThreadPoolConfigdefaultIoThreads(String name, ThreadPoolConfig.ShutdownStrategy strategy) Creates a new transport config that uses the default number of I/O threads and no message worker threads.intReturns the number of I/O threads.intReturns the number of message threads.Returns the thread pool shutdown strategy.Returns the thread pool name.voidsetIoThreads(int count) Sets the number of I/O threads.voidsetMessageThreads(int count) Sets the number of message threads.voidSets thread pool shutdown strategy.voidsetThreadPoolName(String name) Sets the thread pool name.static ThreadPoolConfigsingleIoThread(String name, ThreadPoolConfig.ShutdownStrategy strategy) Creates a new transport config that uses a single I/O thread.toString()Methods inherited from class org.ldaptive.AbstractConfig
checkArrayContainsNull, checkStringInputMethods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, freeze, isFrozen
-
Field Details
-
threadPoolName
Name of the thread pool. -
ioThreads
private int ioThreadsNumber of I/O threads. 0 uses the default number of threads. -
messageThreads
private int messageThreadsNumber of message threads. 0 uses the default number of threads. -1 means do not configure a separate message thread pool -
shutdownStrategy
Thread pool shutdown strategy.
-
-
Constructor Details
-
ThreadPoolConfig
public ThreadPoolConfig()
-
-
Method Details
-
getThreadPoolName
Returns the thread pool name.- Returns:
- thread pool name
-
setThreadPoolName
Sets the thread pool name.- Parameters:
name- thread pool name
-
getIoThreads
public int getIoThreads()Returns the number of I/O threads.- Returns:
- number of I/O threads
-
setIoThreads
public void setIoThreads(int count) Sets the number of I/O threads.- Parameters:
count- number of I/O threads
-
getMessageThreads
public int getMessageThreads()Returns the number of message threads.- Returns:
- number of message threads
-
setMessageThreads
public void setMessageThreads(int count) Sets the number of message threads.- Parameters:
count- number of message threads
-
getShutdownStrategy
Returns the thread pool shutdown strategy.- Returns:
- thread pool shutdown strategy
-
setShutdownStrategy
Sets thread pool shutdown strategy.- Parameters:
strategy- thread pool shutdown strategy
-
toString
-
singleIoThread
public static ThreadPoolConfig singleIoThread(String name, ThreadPoolConfig.ShutdownStrategy strategy) Creates a new transport config that uses a single I/O thread.- Parameters:
name- of the thread poolstrategy- transport shutdown strategy- Returns:
- transport config
-
defaultIoThreads
public static ThreadPoolConfig defaultIoThreads(String name, ThreadPoolConfig.ShutdownStrategy strategy) Creates a new transport config that uses the default number of I/O threads and no message worker threads.- Parameters:
name- of the thread poolstrategy- transport shutdown strategy- Returns:
- transport config
-
builder
Creates a builder for this class.- Returns:
- new builder
-