One can get a default ThreadPoolConfig using ThreadPoolConfig#defaultConfig()
and customize it according to the application specific requirements.
A ThreadPoolConfig object might be customized in a "Builder"-like fashion:
ThreadPoolConfig.defaultConfig()
.setPoolName("App1Pool")
.setCorePoolSize(5)
.setMaxPoolSize(10);
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private static final ThreadPoolConfig | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private ClassLoader | |
| private boolean | |
| private long | |
| private int | |
| private String | |
| private int | |
| private Queue | |
| private int | |
| private ThreadFactory |
| Access | Constructor and Description |
|---|---|
| private | ThreadPoolConfig(String poolName, int corePoolSize, int maxPoolSize, Queue<Runnable> queue, int queueLimit, long keepAliveTime, TimeUnit timeUnit, ThreadFactory threadFactory, int priority, boolean isDaemon, ClassLoader initialClassLoader)
|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public ThreadPoolConfig | |
| public static ThreadPoolConfig | Returns: client thread pool configuration instance.Create new client thread pool configuration instance. |
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
| public int | Returns: the core thread pool size - the size of the thread pool will never bee smaller than this.Get the core thread pool size - the size of the thread pool will never bee smaller than this. |
| public ClassLoader | Returns: the class loader (if any) to be initially exposed by threads from this pool.Get the class loader (if any) to be initially exposed by threads from this pool. |
| public long | Returns: the keep-alive timeout, the value less than 0 means no timeout.time unit to which the result will be converted. timeUnit)Get the max period of time a thread will wait for a new task to process. |
| public int | |
| public String | |
| public int | Returns: priority of the threads in thread pool.Get priority of the threads in thread pool. |
| public Queue | Returns: queue that will be used to temporarily store tasks when all threads in the thread pool are busy.Return a queue that will be used to temporarily store tasks when all threads in the thread pool are busy. |
| public int | Returns: the thread-pool queue limit. The queue limitGet the limit of the queue, where tasks are temporarily stored when all threads are busy. |
| public ThreadFactory | Returns: java. that will be used to create thread pool threads.Return |
| public int | |
| public boolean | Returns: true if thread pool threads are daemons.Return |
| public ThreadPoolConfig | Returns: theThreadPoolConfig with the new core pool size set.the core thread pool size - the size of the thread pool will never bee smaller than this. corePoolSize)Set the core thread pool size - the size of the thread pool will never bee smaller than this. |
| public ThreadPoolConfig | Returns: theThreadPoolConfig with the daemon property set.true if thread pool threads are daemons.Set |
| public ThreadPoolConfig | Returns: theThreadPoolConfig with the class loader set.the class loader to be exposed by threads of this pool. initialClassLoader)Specifies the context class loader that will be used by threads in this pool. |
| public ThreadPoolConfig | Returns: theThreadPoolConfig with the new keep alive time.max keep alive timeout. The value less than 0 means no timeout. time, TimeUnit time unit. unit)The max period of time a thread will wait for a new task to process. |
| public ThreadPoolConfig | Returns: theThreadPoolConfig with the new max pool size set.the max thread pool size. maxPoolSize)Set max thread pool size. |
| public ThreadPoolConfig | Returns: theThreadPoolConfig with the new thread pool name.the thread pool name. poolName)Set thread pool name. |
| public ThreadPoolConfig | Returns: theThreadPoolConfig with the new thread priority.of the threads in thread pool. priority)Set priority of the threads in thread pool. |
| public ThreadPoolConfig | |
| public ThreadPoolConfig | Returns: theThreadPoolConfig with the new queue limit.the thread pool queue limit. The queueLimit)queueLimit value less than 0 means unlimited queue.Set the limit of the queue, where tasks are temporarily stored when all threads are busy. |
| public ThreadPoolConfig | setThreadFactory(ThreadFactory
custom threadFactory)java. If
java. is set, then priority, isDaemon, poolName settings will not be considered when creating new threads.Set |
| public String |
| corePoolSize | back to summary |
|---|---|
| private int corePoolSize | |
| DEFAULT | back to summary |
|---|---|
| private static final ThreadPoolConfig DEFAULT | |
| DEFAULT_CORE_POOL_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_CORE_POOL_SIZE | |
| DEFAULT_IDLE_THREAD_KEEP_ALIVE_TIMEOUT | back to summary |
|---|---|
| private static final int DEFAULT_IDLE_THREAD_KEEP_ALIVE_TIMEOUT | |
| DEFAULT_MAX_POOL_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_MAX_POOL_SIZE | |
| DEFAULT_MAX_QUEUE_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_MAX_QUEUE_SIZE | |
| initialClassLoader | back to summary |
|---|---|
| private ClassLoader initialClassLoader | |
| isDaemon | back to summary |
|---|---|
| private boolean isDaemon | |
| keepAliveTimeMillis | back to summary |
|---|---|
| private long keepAliveTimeMillis | |
| maxPoolSize | back to summary |
|---|---|
| private int maxPoolSize | |
| poolName | back to summary |
|---|---|
| private String poolName | |
| priority | back to summary |
|---|---|
| private int priority | |
| queue | back to summary |
|---|---|
| private Queue<Runnable> queue | |
| queueLimit | back to summary |
|---|---|
| private int queueLimit | |
| threadFactory | back to summary |
|---|---|
| private ThreadFactory threadFactory | |
| ThreadPoolConfig | back to summary |
|---|---|
| private ThreadPoolConfig(String poolName, int corePoolSize, int maxPoolSize, Queue<Runnable> queue, int queueLimit, long keepAliveTime, TimeUnit timeUnit, ThreadFactory threadFactory, int priority, boolean isDaemon, ClassLoader initialClassLoader) | |
| ThreadPoolConfig | back to summary |
|---|---|
| private ThreadPoolConfig(ThreadPoolConfig cfg) | |
| copy | back to summary |
|---|---|
| public ThreadPoolConfig copy() Return a copy of this thread pool config.
| |
| defaultConfig | back to summary |
|---|---|
| public static ThreadPoolConfig defaultConfig() Create new client thread pool configuration instance. The returned
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getCorePoolSize | back to summary |
|---|---|
| public int getCorePoolSize() Get the core thread pool size - the size of the thread pool will never bee smaller than this. The default is 1.
| |
| getInitialClassLoader | back to summary |
|---|---|
| public ClassLoader getInitialClassLoader() Get the class loader (if any) to be initially exposed by threads from this pool. If not specified, the class loader of the parent thread that initialized the pool will be used.Authen
| |
| getKeepAliveTime | back to summary |
|---|---|
| public long getKeepAliveTime(TimeUnit timeUnit) Get the max period of time a thread will wait for a new task to process.
If the timeout expires and the thread is not a core one (see The default is 10s.
| |
| getMaxPoolSize | back to summary |
|---|---|
| public int getMaxPoolSize() Get max thread pool size. The default is
| |
| getPoolName | back to summary |
|---|---|
| public String getPoolName() Return thread pool name. The default is "Tyrus-client".
| |
| getPriority | back to summary |
|---|---|
| public int getPriority() Get priority of the threads in thread pool. The default is
| |
| getQueue | back to summary |
|---|---|
| public Queue Return a queue that will be used to temporarily store tasks when all threads in the thread pool are busy. | |
| getQueueLimit | back to summary |
|---|---|
| public int getQueueLimit() Get the limit of the queue, where tasks are temporarily stored when all threads are busy. Value less than 0 means unlimited queue. The default is -1.
| |
| getThreadFactory | back to summary |
|---|---|
| public ThreadFactory getThreadFactory() Return
If
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isDaemon | back to summary |
|---|---|
| public boolean isDaemon() Return
| |
| setCorePoolSize | back to summary |
|---|---|
| public ThreadPoolConfig setCorePoolSize(int corePoolSize) Set the core thread pool size - the size of the thread pool will never bee smaller than this. The default is 1.
| |
| setDaemon | back to summary |
|---|---|
| public ThreadPoolConfig setDaemon(boolean isDaemon) Set
| |
| setInitialClassLoader | back to summary |
|---|---|
| public ThreadPoolConfig setInitialClassLoader(final ClassLoader initialClassLoader) Specifies the context class loader that will be used by threads in this pool. If not specified, the class loader of the parent thread that initialized the pool will be used.
| |
| setKeepAliveTime | back to summary |
|---|---|
| public ThreadPoolConfig setKeepAliveTime(long time, TimeUnit unit) The max period of time a thread will wait for a new task to process.
If the timeout expires and the thread is not a core one (see The default is 10s.
| |
| setMaxPoolSize | back to summary |
|---|---|
| public ThreadPoolConfig setMaxPoolSize(int maxPoolSize) Set max thread pool size. The default is The default is Cannot be smaller than 3.
| |
| setPoolName | back to summary |
|---|---|
| public ThreadPoolConfig setPoolName(String poolName) Set thread pool name. The default is "Tyrus-client".
| |
| setPriority | back to summary |
|---|---|
| public ThreadPoolConfig setPriority(int priority) Set priority of the threads in thread pool. The default is
| |
| setQueue | back to summary |
|---|---|
| public ThreadPoolConfig setQueue(Queue<Runnable> queue) Set a queue implementation that will be used to temporarily store tasks when all threads in the thread pool are busy.
| |
| setQueueLimit | back to summary |
|---|---|
| public ThreadPoolConfig setQueueLimit(int queueLimit) Set the limit of the queue, where tasks are temporarily stored when all threads are busy. Value less than 0 means unlimited queue. The default is -1.
| |
| setThreadFactory | back to summary |
|---|---|
| public ThreadPoolConfig setThreadFactory(ThreadFactory threadFactory) Set
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |