feat:The core thread must not be larger than the maximum thread. (#838)

pull/840/head
WuLang 2 years ago committed by GitHub
parent 6905452b33
commit 8e397741d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -112,6 +112,9 @@ public class ThreadPoolBuilder implements Builder<ThreadPoolExecutor> {
public ThreadPoolBuilder maxPoolNum(int maxPoolSize) { public ThreadPoolBuilder maxPoolNum(int maxPoolSize) {
this.maxPoolSize = maxPoolSize; this.maxPoolSize = maxPoolSize;
if (maxPoolSize < this.corePoolSize) {
this.corePoolSize = maxPoolSize;
}
return this; return this;
} }
@ -228,6 +231,7 @@ public class ThreadPoolBuilder implements Builder<ThreadPoolExecutor> {
/** /**
* Create dynamic thread pool by thread pool id * Create dynamic thread pool by thread pool id
*
* @param threadPoolId threadPoolId * @param threadPoolId threadPoolId
* @return ThreadPoolExecutor * @return ThreadPoolExecutor
*/ */

Loading…
Cancel
Save