Create ServerThreadPoolDynamicRefresh.java

判断当前值和修改后的值大小,来判断 core 和 max 哪个先赋值
pull/191/head
hushtian 3 years ago committed by GitHub
parent 7bfe924a49
commit 353efa16b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -123,12 +123,21 @@ public class ServerThreadPoolDynamicRefresh implements ThreadPoolDynamicRefresh
* @param parameter
*/
public void changePoolInfo(ThreadPoolExecutor executor, PoolParameter parameter) {
if (parameter.getCoreSize() != null) {
executor.setCorePoolSize(parameter.getCoreSize());
}
if (parameter.getMaxSize() != null) {
executor.setMaximumPoolSize(parameter.getMaxSize());
if (parameter.getCoreSize() != null&&parameter.getMaxSize() !=null) {
if (parameter.getMaxSize() < executor.getMaximumPoolSize()) {
executor.setCorePoolSize(parameter.getCoreSize());
executor.setMaximumPoolSize(parameter.getMaxSize());
} else {
executor.setMaximumPoolSize(parameter.getMaxSize());
executor.setCorePoolSize(parameter.getCoreSize());
}
}else {
if (parameter.getMaxSize() != null) {
executor.setMaximumPoolSize(parameter.getMaxSize());
}
if (parameter.getCoreSize() != null) {
executor.setCorePoolSize(parameter.getCoreSize());
}
}
if (parameter.getCapacity() != null

Loading…
Cancel
Save