public class ThreadPoolBuilder extends Object implements Builder<ThreadPoolExecutor>
| 构造器和说明 |
|---|
ThreadPoolBuilder() |
| 限定符和类型 | 方法和说明 |
|---|---|
ThreadPoolBuilder |
allowCoreThreadTimeOut(boolean allowCoreThreadTimeOut)
Allow core thread time-out.
|
ThreadPoolBuilder |
awaitTerminationMillis(long awaitTerminationMillis)
Await termination millis.
|
ThreadPoolExecutor |
build() |
static ThreadPoolExecutor |
buildDynamicPoolById(String threadPoolId)
Create dynamic thread pool by thread pool id.
|
static ThreadPoolBuilder |
builder()
Builder design pattern implementation.
|
ThreadPoolBuilder |
capacity(int capacity)
Capacity.
|
ThreadPoolBuilder |
corePoolSize(int corePoolSize)
Core pool size.
|
ThreadPoolBuilder |
dynamicPool()
Dynamic pool.
|
ThreadPoolBuilder |
dynamicSupport(boolean waitForTasksToCompleteOnShutdown,
long awaitTerminationMillis)
Dynamic support.
|
ThreadPoolBuilder |
executeTimeOut(long executeTimeOut)
Execute time-out.
|
ThreadPoolBuilder |
isFastPool(Boolean isFastPool)
Is fast pool.
|
ThreadPoolBuilder |
keepAliveTime(long keepAliveTime)
Keep alive time.
|
ThreadPoolBuilder |
keepAliveTime(long keepAliveTime,
TimeUnit timeUnit)
Keep alive time.
|
ThreadPoolBuilder |
maxPoolNum(int maxPoolSize)
Max pool num.
|
ThreadPoolBuilder |
poolThreadSize(int corePoolSize,
int maxPoolSize)
Pool thread size.
|
ThreadPoolBuilder |
rejected(RejectedExecutionHandler rejectedExecutionHandler)
Rejected.
|
ThreadPoolBuilder |
singlePool()
Single pool.
|
ThreadPoolBuilder |
singlePool(String threadNamePrefix)
Single pool.
|
ThreadPoolBuilder |
taskDecorator(org.springframework.core.task.TaskDecorator taskDecorator)
Task decorator.
|
ThreadPoolBuilder |
threadFactory(String threadNamePrefix)
Thread factory.
|
ThreadPoolBuilder |
threadFactory(String threadNamePrefix,
Boolean isDaemon)
Thread factory.
|
ThreadPoolBuilder |
threadFactory(ThreadFactory threadFactory)
Thread factory.
|
ThreadPoolBuilder |
threadPoolId(String threadPoolId)
Thread-pool id.
|
ThreadPoolBuilder |
timeUnit(TimeUnit timeUnit)
Time unit.
|
ThreadPoolBuilder |
waitForTasksToCompleteOnShutdown(boolean waitForTasksToCompleteOnShutdown)
Wait for tasks to complete on shutdown.
|
ThreadPoolBuilder |
workQueue(BlockingQueue workQueue)
Work queue.
|
ThreadPoolBuilder |
workQueue(BlockingQueueTypeEnum blockingQueueType)
Work queue.
|
ThreadPoolBuilder |
workQueue(BlockingQueueTypeEnum queueType,
int capacity)
Work queue.
|
public ThreadPoolBuilder isFastPool(Boolean isFastPool)
isFastPool - is fast poolpublic ThreadPoolBuilder dynamicPool()
public ThreadPoolBuilder threadFactory(String threadNamePrefix)
threadNamePrefix - thread name prefixpublic ThreadPoolBuilder threadFactory(ThreadFactory threadFactory)
threadFactory - thread factorypublic ThreadPoolBuilder threadFactory(String threadNamePrefix, Boolean isDaemon)
threadNamePrefix - thread name prefixisDaemon - is daemonpublic ThreadPoolBuilder corePoolSize(int corePoolSize)
corePoolSize - core pool sizepublic ThreadPoolBuilder maxPoolNum(int maxPoolSize)
maxPoolSize - max pool numpublic ThreadPoolBuilder singlePool()
public ThreadPoolBuilder singlePool(String threadNamePrefix)
threadNamePrefix - thread name prefixpublic ThreadPoolBuilder poolThreadSize(int corePoolSize, int maxPoolSize)
corePoolSize - core pool sizemaxPoolSize - max pool sizepublic ThreadPoolBuilder keepAliveTime(long keepAliveTime)
keepAliveTime - keep alive timepublic ThreadPoolBuilder timeUnit(TimeUnit timeUnit)
timeUnit - time unitpublic ThreadPoolBuilder executeTimeOut(long executeTimeOut)
executeTimeOut - execute time-outpublic ThreadPoolBuilder keepAliveTime(long keepAliveTime, TimeUnit timeUnit)
keepAliveTime - keep alive timetimeUnit - time unitpublic ThreadPoolBuilder capacity(int capacity)
capacity - capacitypublic ThreadPoolBuilder workQueue(BlockingQueueTypeEnum queueType, int capacity)
queueType - queue typecapacity - capacitypublic ThreadPoolBuilder rejected(RejectedExecutionHandler rejectedExecutionHandler)
rejectedExecutionHandler - rejected execution handlerpublic ThreadPoolBuilder workQueue(BlockingQueueTypeEnum blockingQueueType)
blockingQueueType - blocking queue typepublic ThreadPoolBuilder workQueue(BlockingQueue workQueue)
workQueue - work queuepublic ThreadPoolBuilder threadPoolId(String threadPoolId)
threadPoolId - thread-pool idpublic ThreadPoolBuilder taskDecorator(org.springframework.core.task.TaskDecorator taskDecorator)
taskDecorator - task decoratorpublic ThreadPoolBuilder awaitTerminationMillis(long awaitTerminationMillis)
awaitTerminationMillis - await termination millispublic ThreadPoolBuilder waitForTasksToCompleteOnShutdown(boolean waitForTasksToCompleteOnShutdown)
waitForTasksToCompleteOnShutdown - wait for tasks to complete on shutdownpublic ThreadPoolBuilder dynamicSupport(boolean waitForTasksToCompleteOnShutdown, long awaitTerminationMillis)
waitForTasksToCompleteOnShutdown - wait for tasks to complete on shutdownawaitTerminationMillis - await termination millispublic ThreadPoolBuilder allowCoreThreadTimeOut(boolean allowCoreThreadTimeOut)
allowCoreThreadTimeOut - core thread time-outpublic static ThreadPoolBuilder builder()
public static ThreadPoolExecutor buildDynamicPoolById(String threadPoolId)
threadPoolId - thread-pool idpublic ThreadPoolExecutor build()
build 在接口中 Builder<ThreadPoolExecutor>Copyright © 2022. All rights reserved.