From 6dfa7701372e7bbdf5cd65d4083b227e02943249 Mon Sep 17 00:00:00 2001 From: yukaidi Date: Fri, 29 May 2026 00:33:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(performance):=20CommonUtil=20initConfig=20?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=BC=82=E6=AD=A5=E9=9D=9E=E9=98=BB=E5=A1=9E?= =?UTF-8?q?=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/qaiu/vx/core/util/CommonUtil.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/cn/qaiu/vx/core/util/CommonUtil.java b/core/src/main/java/cn/qaiu/vx/core/util/CommonUtil.java index d9da4ff..22886ce 100644 --- a/core/src/main/java/cn/qaiu/vx/core/util/CommonUtil.java +++ b/core/src/main/java/cn/qaiu/vx/core/util/CommonUtil.java @@ -100,18 +100,21 @@ public class CommonUtil { } /** - * 处理其他配置 + * 处理其他配置(异步非阻塞方式) * * @param configName configName */ public static void initConfig(String configName, Class tClass) { URL resource = tClass.getResource("/conf/" + configName); if (resource == null) throw new RuntimeException("路径不存在"); - Buffer buffer = VertxHolder.getVertxInstance().fileSystem().readFileBlocking(resource.getPath()); - JsonObject entries = new JsonObject(buffer); - Map map = entries.getMap(); - LocalConstant.put(configName, map); - LOGGER.info("读取配置{}成功", configName); + VertxHolder.getVertxInstance().fileSystem().readFile(resource.getPath()) + .onSuccess(buffer -> { + JsonObject entries = new JsonObject(buffer); + Map map = entries.getMap(); + LocalConstant.put(configName, map); + LOGGER.info("读取配置{}成功", configName); + }) + .onFailure(err -> LOGGER.error("读取配置{}失败", configName, err)); } public static Set sortClassSet(Set> set) {