Merge pull request #218 from selectbook/develop

fix issue 192
pull/222/head
龙台 Long Tai 3 years ago committed by GitHub
commit 621b86870d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -251,12 +251,24 @@ public abstract class AbstractCoreThreadPoolDynamicRefresh implements ThreadPool
private void dynamicRefreshPool(String threadPoolId, ExecutorProperties properties) {
ExecutorProperties beforeProperties = GlobalCoreThreadPoolManage.getProperties(properties.getThreadPoolId());
ThreadPoolExecutor executor = GlobalThreadPoolManage.getExecutorService(threadPoolId).getExecutor();
if (!Objects.equals(beforeProperties.getMaximumPoolSize(), properties.getMaximumPoolSize())) {
executor.setMaximumPoolSize(properties.getMaximumPoolSize());
}
if (!Objects.equals(beforeProperties.getCorePoolSize(), properties.getCorePoolSize())) {
executor.setCorePoolSize(properties.getCorePoolSize());
if (properties.getMaximumPoolSize() != null && properties.getCorePoolSize() !=null) {
if (properties.getMaximumPoolSize() < executor.getMaximumPoolSize()) {
executor.setMaximumPoolSize(properties.getMaximumPoolSize());
executor.setCorePoolSize(properties.getCorePoolSize());
} else {
executor.setMaximumPoolSize(properties.getMaximumPoolSize());
executor.setCorePoolSize(properties.getCorePoolSize());
}
} else {
if (properties.getMaximumPoolSize() != null) {
executor.setMaximumPoolSize(properties.getMaximumPoolSize());
}
if (properties.getCorePoolSize() !=null) {
executor.setCorePoolSize(properties.getCorePoolSize());
}
}
if (!Objects.equals(beforeProperties.getAllowCoreThreadTimeOut(), properties.getAllowCoreThreadTimeOut())) {
executor.allowCoreThreadTimeOut(properties.getAllowCoreThreadTimeOut());
}

Loading…
Cancel
Save