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

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

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

Loading…
Cancel
Save