Merge pull request #191 from hushtian/develop

Create ServerThreadPoolDynamicRefresh.java
pull/197/head
龙台 Long Tai 3 years ago committed by GitHub
commit 92a98ebb50
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