适配非 Web SpringBoot 项目使用 Hippo4J. (#147)

pull/153/head
chen.ma 3 years ago
parent 6a34754dd8
commit 6a5ee7fcef

@ -100,11 +100,19 @@ public abstract class AbstractCoreThreadPoolDynamicRefresh implements ThreadPool
* @param bindableCoreProperties
*/
private void refreshWebExecutor(BootstrapCoreProperties bindableCoreProperties) {
WebThreadPoolHandlerChoose webThreadPoolHandlerChoose = ApplicationContextHolder.getBean(WebThreadPoolHandlerChoose.class);
WebThreadPoolService webThreadPoolService = webThreadPoolHandlerChoose.choose();
boolean isNullFlag = bindableCoreProperties.getJetty() == null
|| bindableCoreProperties.getUndertow() == null
|| bindableCoreProperties.getTomcat() == null;
if (isNullFlag) {
return;
}
try {
PoolParameterInfo nowParameter = buildWebPoolParameter(bindableCoreProperties);
if (nowParameter != null) {
WebThreadPoolHandlerChoose webThreadPoolHandlerChoose = ApplicationContextHolder.getBean(WebThreadPoolHandlerChoose.class);
WebThreadPoolService webThreadPoolService = webThreadPoolHandlerChoose.choose();
PoolParameter beforeParameter = webThreadPoolService.getWebThreadPoolParameter();
if (!Objects.equals(beforeParameter.getCoreSize(), nowParameter.getCoreSize())
|| !Objects.equals(beforeParameter.getMaxSize(), nowParameter.getMaxSize())
@ -112,6 +120,9 @@ public abstract class AbstractCoreThreadPoolDynamicRefresh implements ThreadPool
webThreadPoolService.updateWebThreadPool(nowParameter);
}
}
} catch (Exception ex) {
log.error("Failed to modify web thread pool.", ex);
}
}
/**

Loading…
Cancel
Save