Package org.ldaptive.transport
Class ThreadPoolConfig
- java.lang.Object
-
- org.ldaptive.AbstractFreezable
-
- org.ldaptive.AbstractConfig
-
- org.ldaptive.transport.ThreadPoolConfig
-
- All Implemented Interfaces:
Freezable
public final class ThreadPoolConfig extends AbstractConfig
Contains configuration properties for creating thread pools used by transports.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classThreadPoolConfig.Builderstatic classThreadPoolConfig.ShutdownStrategyEnum to describe how thread pools should be shutdown.
-
Field Summary
Fields Modifier and Type Field Description private intioThreadsNumber of I/O threads. 0 uses the default number of threads.private intmessageThreadsNumber of message threads. 0 uses the default number of threadsprivate ThreadPoolConfig.ShutdownStrategyshutdownStrategyThread pool shutdown strategy.private StringthreadPoolNameName of the thread pool.-
Fields inherited from class org.ldaptive.AbstractConfig
logger
-
-
Constructor Summary
Constructors Constructor Description ThreadPoolConfig()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static 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.intgetIoThreads()Returns the number of I/O threads.intgetMessageThreads()Returns the number of message threads.ThreadPoolConfig.ShutdownStrategygetShutdownStrategy()Returns the thread pool shutdown strategy.StringgetThreadPoolName()Returns the thread pool name.voidsetIoThreads(int count)Sets the number of I/O threads.voidsetMessageThreads(int count)Sets the number of message threads.voidsetShutdownStrategy(ThreadPoolConfig.ShutdownStrategy strategy)Sets 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.StringtoString()-
Methods inherited from class org.ldaptive.AbstractConfig
checkArrayContainsNull, checkStringInput
-
Methods inherited from class org.ldaptive.AbstractFreezable
assertMutable, freeze, freeze, freeze, isFrozen
-
-
-
-
Field Detail
-
threadPoolName
private String threadPoolName
Name of the thread pool.
-
ioThreads
private int ioThreads
Number of I/O threads. 0 uses the default number of threads.
-
messageThreads
private int messageThreads
Number of message threads. 0 uses the default number of threads. -1 means do not configure a separate message thread pool
-
shutdownStrategy
private ThreadPoolConfig.ShutdownStrategy shutdownStrategy
Thread pool shutdown strategy.
-
-
Method Detail
-
getThreadPoolName
public String getThreadPoolName()
Returns the thread pool name.- Returns:
- thread pool name
-
setThreadPoolName
public void setThreadPoolName(String name)
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
public ThreadPoolConfig.ShutdownStrategy getShutdownStrategy()
Returns the thread pool shutdown strategy.- Returns:
- thread pool shutdown strategy
-
setShutdownStrategy
public void setShutdownStrategy(ThreadPoolConfig.ShutdownStrategy strategy)
Sets thread pool shutdown strategy.- Parameters:
strategy- thread pool shutdown strategy
-
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
public static ThreadPoolConfig.Builder builder()
Creates a builder for this class.- Returns:
- new builder
-
-