From adcab381a215ce03e767a666f1b44427de899930 Mon Sep 17 00:00:00 2001 From: yewei <17855368071@163.com> Date: Sun, 9 Oct 2022 17:29:14 +0800 Subject: [PATCH] fix sql && update hippo4j.core.auth.enabled=true in server properties && optimize code in AdapterThreadPoolConfigModificationVerifyServiceImpl and WebThreadPoolConfigModificationVerifyServiceImpl --- .../hippo4j/config/service/ThreadPoolAdapterService.java | 7 ++----- ...apterThreadPoolConfigModificationVerifyServiceImpl.java | 1 - .../WebThreadPoolConfigModificationVerifyServiceImpl.java | 1 - hippo4j-server/src/main/resources/application.properties | 2 +- .../main/resources/sql-script/mysql/hippo4j_manager.sql | 3 +-- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/hippo4j-config/src/main/java/cn/hippo4j/config/service/ThreadPoolAdapterService.java b/hippo4j-config/src/main/java/cn/hippo4j/config/service/ThreadPoolAdapterService.java index 2a595939..309b02a8 100644 --- a/hippo4j-config/src/main/java/cn/hippo4j/config/service/ThreadPoolAdapterService.java +++ b/hippo4j-config/src/main/java/cn/hippo4j/config/service/ThreadPoolAdapterService.java @@ -139,11 +139,8 @@ public class ThreadPoolAdapterService { public static void remove(String identify) { synchronized (ThreadPoolAdapterService.class) { - THREAD_POOL_ADAPTER_MAP.values().forEach(each -> each.forEach((key, val) -> - val.forEach((threadPoolKey, states) -> - states.removeIf(adapterState -> Objects.equals(adapterState.getIdentify(), identify)) - ) - )); + THREAD_POOL_ADAPTER_MAP.values() + .forEach(each -> each.forEach((key, val) -> val.forEach((threadPoolKey, states) -> states.removeIf(adapterState -> Objects.equals(adapterState.getIdentify(), identify))))); } } diff --git a/hippo4j-config/src/main/java/cn/hippo4j/config/service/biz/impl/AdapterThreadPoolConfigModificationVerifyServiceImpl.java b/hippo4j-config/src/main/java/cn/hippo4j/config/service/biz/impl/AdapterThreadPoolConfigModificationVerifyServiceImpl.java index 1e5fc4f2..dbc53008 100644 --- a/hippo4j-config/src/main/java/cn/hippo4j/config/service/biz/impl/AdapterThreadPoolConfigModificationVerifyServiceImpl.java +++ b/hippo4j-config/src/main/java/cn/hippo4j/config/service/biz/impl/AdapterThreadPoolConfigModificationVerifyServiceImpl.java @@ -46,7 +46,6 @@ public class AdapterThreadPoolConfigModificationVerifyServiceImpl extends Abstra protected void updateThreadPoolParameter(ConfigModifyVerifyReqDTO reqDTO) { for (String each : getClientAddress(reqDTO)) { String urlString = StringUtil.newBuilder("http://", each, "/adapter/thread-pool/update"); - RestTemplate restTemplate = new RestTemplate(); // again appoint MediaType HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.setContentType(MediaType.APPLICATION_JSON); diff --git a/hippo4j-config/src/main/java/cn/hippo4j/config/service/biz/impl/WebThreadPoolConfigModificationVerifyServiceImpl.java b/hippo4j-config/src/main/java/cn/hippo4j/config/service/biz/impl/WebThreadPoolConfigModificationVerifyServiceImpl.java index f0af1fa5..301ef85b 100644 --- a/hippo4j-config/src/main/java/cn/hippo4j/config/service/biz/impl/WebThreadPoolConfigModificationVerifyServiceImpl.java +++ b/hippo4j-config/src/main/java/cn/hippo4j/config/service/biz/impl/WebThreadPoolConfigModificationVerifyServiceImpl.java @@ -46,7 +46,6 @@ public class WebThreadPoolConfigModificationVerifyServiceImpl extends AbstractCo protected void updateThreadPoolParameter(ConfigModifyVerifyReqDTO reqDTO) { for (String each : getClientAddress(reqDTO)) { String urlString = StringUtil.newBuilder("http://", each, "/web/update/pool"); - RestTemplate restTemplate = new RestTemplate(); // again appoint MediaType HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.setContentType(MediaType.APPLICATION_JSON); diff --git a/hippo4j-server/src/main/resources/application.properties b/hippo4j-server/src/main/resources/application.properties index 865f88f3..354af4fd 100644 --- a/hippo4j-server/src/main/resources/application.properties +++ b/hippo4j-server/src/main/resources/application.properties @@ -22,7 +22,7 @@ hippo4j.core.clean-history-data-period=30 hippo4j.core.clean-history-data-enable=true ### Whether to enable authentication. -hippo4j.core.auth.enabled=false +hippo4j.core.auth.enabled=true ### Initialize the database dialect class. hippo4j.database.dialect=mysql diff --git a/hippo4j-server/src/main/resources/sql-script/mysql/hippo4j_manager.sql b/hippo4j-server/src/main/resources/sql-script/mysql/hippo4j_manager.sql index 64ed9118..d3e2f9f9 100644 --- a/hippo4j-server/src/main/resources/sql-script/mysql/hippo4j_manager.sql +++ b/hippo4j-server/src/main/resources/sql-script/mysql/hippo4j_manager.sql @@ -201,8 +201,7 @@ CREATE TABLE IF NOT EXISTS `notify` ( -- ---------------------------- -- Table structure for his_config_verify -- ---------------------------- -DROP TABLE IF EXISTS `his_config_verify`; -CREATE TABLE `his_config_verify` ( +CREATE TABLE IF NOT EXISTS `his_config_verify` ( `id` bigint UNSIGNED NOT NULL AUTO_INCREMENT, `type` int NULL DEFAULT NULL COMMENT '变更类型', `mark` varchar(128) DEFAULT NULL COMMENT '框架线程池类型',