|
|
|
@ -1,10 +1,10 @@
|
|
|
|
|
package io.dynamic.threadpool.starter.builder;
|
|
|
|
|
package io.dynamic.threadpool.starter.toolkit.thread;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import io.dynamic.threadpool.common.enums.QueueTypeEnum;
|
|
|
|
|
import io.dynamic.threadpool.common.toolkit.Assert;
|
|
|
|
|
import io.dynamic.threadpool.starter.builder.Builder;
|
|
|
|
|
import io.dynamic.threadpool.starter.toolkit.BlockingQueueUtil;
|
|
|
|
|
import io.dynamic.threadpool.starter.toolkit.thread.AbstractBuildThreadPoolTemplate;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
@ -108,6 +108,12 @@ public class ThreadPoolBuilder implements Builder<ThreadPoolExecutor> {
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ThreadPoolBuilder poolThreadNum(Integer corePoolNum, Integer maxPoolNum) {
|
|
|
|
|
this.corePoolNum = corePoolNum;
|
|
|
|
|
this.maxPoolNum = maxPoolNum;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ThreadPoolBuilder keepAliveTime(Long keepAliveTime) {
|
|
|
|
|
this.keepAliveTime = keepAliveTime;
|
|
|
|
|
return this;
|
|
|
|
@ -118,11 +124,23 @@ public class ThreadPoolBuilder implements Builder<ThreadPoolExecutor> {
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ThreadPoolBuilder keepAliveTime(Long keepAliveTime, TimeUnit timeUnit) {
|
|
|
|
|
this.keepAliveTime = keepAliveTime;
|
|
|
|
|
this.timeUnit = timeUnit;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ThreadPoolBuilder capacity(Integer capacity) {
|
|
|
|
|
this.capacity = capacity;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ThreadPoolBuilder workQueue(QueueTypeEnum queueType, Integer capacity) {
|
|
|
|
|
this.queueType = queueType;
|
|
|
|
|
this.capacity = capacity;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ThreadPoolBuilder rejected(RejectedExecutionHandler rejectedExecutionHandler) {
|
|
|
|
|
this.rejectedExecutionHandler = rejectedExecutionHandler;
|
|
|
|
|
return this;
|