Skip to content

Commit

Permalink
rename maxPoolNum to maximumPoolSize
Browse files Browse the repository at this point in the history
  • Loading branch information
jjiey committed Mar 2, 2023
1 parent 398418e commit b1c24c4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static ThreadPoolExecutor buildPool(ThreadPoolInitParam initParam) {
ThreadPoolExecutor executorService;
try {
executorService = new ThreadPoolExecutorTemplate(initParam.getCorePoolNum(),
initParam.getMaxPoolNum(),
initParam.getMaximumPoolSize(),
initParam.getKeepAliveTime(),
initParam.getTimeUnit(),
initParam.getWorkQueue(),
Expand Down Expand Up @@ -97,7 +97,7 @@ public static ThreadPoolExecutor buildFastPool(ThreadPoolInitParam initParam) {
FastThreadPoolExecutor fastThreadPoolExecutor;
try {
fastThreadPoolExecutor = new FastThreadPoolExecutor(initParam.getCorePoolNum(),
initParam.getMaxPoolNum(),
initParam.getMaximumPoolSize(),
initParam.getKeepAliveTime(),
initParam.getTimeUnit(),
taskQueue,
Expand All @@ -123,7 +123,7 @@ public static DynamicThreadPoolExecutor buildDynamicPool(ThreadPoolInitParam ini
try {
dynamicThreadPoolExecutor = new DynamicThreadPoolExecutor(
initParam.getCorePoolNum(),
initParam.getMaxPoolNum(),
initParam.getMaximumPoolSize(),
initParam.getKeepAliveTime(),
initParam.getTimeUnit(),
initParam.getExecuteTimeOut(),
Expand All @@ -150,8 +150,14 @@ public static class ThreadPoolInitParam {

private Integer corePoolNum;

/**
* @deprecated use {@link #maximumPoolSize}
*/
@Deprecated
private Integer maxPoolNum;

private Integer maximumPoolSize;

private Long keepAliveTime;

private TimeUnit timeUnit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,21 @@ public ThreadPoolBuilder corePoolSize(int corePoolSize) {
return this;
}

/**
* @deprecated Use {@link #maximumPoolSize}
*/
@Deprecated
public ThreadPoolBuilder maxPoolNum(int maxPoolSize) {
return this.maximumPoolSize(maxPoolSize);
}

/**
* Max pool num.
*
* @param maxPoolSize max pool num
* @return thread-pool builder
*/
public ThreadPoolBuilder maxPoolNum(int maxPoolSize) {
public ThreadPoolBuilder maximumPoolSize(int maxPoolSize) {
this.maxPoolSize = maxPoolSize;
if (maxPoolSize < this.corePoolSize) {
this.corePoolSize = maxPoolSize;
Expand Down Expand Up @@ -438,7 +446,7 @@ private static AbstractBuildThreadPoolTemplate.ThreadPoolInitParam buildInitPara
initParam = new AbstractBuildThreadPoolTemplate.ThreadPoolInitParam(builder.threadFactory);
}
initParam.setCorePoolNum(builder.corePoolSize)
.setMaxPoolNum(builder.maxPoolSize)
.setMaximumPoolSize(builder.maxPoolSize)
.setKeepAliveTime(builder.keepAliveTime)
.setCapacity(builder.capacity)
.setExecuteTimeOut(builder.executeTimeOut)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public DynamicThreadPoolExecutor unwrap(Object executor) {
ThreadPoolBuilder threadPoolBuilder = ThreadPoolBuilder.builder()
.dynamicPool()
.corePoolSize(threadPoolTaskExecutor.getCorePoolSize())
.maxPoolNum(threadPoolTaskExecutor.getMaxPoolSize())
.maximumPoolSize(threadPoolTaskExecutor.getMaxPoolSize())
.keepAliveTime(threadPoolTaskExecutor.getKeepAliveSeconds())
.timeUnit(TimeUnit.SECONDS)
.allowCoreThreadTimeOut(threadPoolExecutor.allowsCoreThreadTimeOut())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public ThreadPoolExecutor buildDynamicThreadPoolExecutor(DynamicThreadPoolRegist
ThreadPoolExecutor dynamicThreadPoolExecutor = ThreadPoolBuilder.builder()
.threadPoolId(registerParameter.getThreadPoolId())
.corePoolSize(registerParameter.getCorePoolSize())
.maxPoolNum(registerParameter.getMaximumPoolSize())
.maximumPoolSize(registerParameter.getMaximumPoolSize())
.workQueue(BlockingQueueTypeEnum.createBlockingQueue(registerParameter.getBlockingQueueType().getType(), registerParameter.getCapacity()))
.threadFactory(registerParameter.getThreadNamePrefix())
.threadFactory(registerParameter.getThreadFactory())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class DynamicThreadPoolSubscribeConfig {

private final ExecutorService configRefreshExecutorService = ThreadPoolBuilder.builder()
.corePoolSize(1)
.maxPoolNum(2)
.maximumPoolSize(2)
.keepAliveTime(2000)
.timeUnit(TimeUnit.MILLISECONDS)
.workQueue(BlockingQueueTypeEnum.SYNCHRONOUS_QUEUE)
Expand Down

0 comments on commit b1c24c4

Please sign in to comment.