Revert "fix(performance): CommonUtil initConfig 改为异步非阻塞读取"

This reverts commit 6dfa770137.
This commit is contained in:
yukaidi
2026-05-29 00:37:27 +08:00
parent efb135ee48
commit 1c2291f9cf

View File

@@ -100,21 +100,18 @@ public class CommonUtil {
} }
/** /**
* 处理其他配置(异步非阻塞方式) * 处理其他配置
* *
* @param configName configName * @param configName configName
*/ */
public static void initConfig(String configName, Class<?> tClass) { public static void initConfig(String configName, Class<?> tClass) {
URL resource = tClass.getResource("/conf/" + configName); URL resource = tClass.getResource("/conf/" + configName);
if (resource == null) throw new RuntimeException("路径不存在"); if (resource == null) throw new RuntimeException("路径不存在");
VertxHolder.getVertxInstance().fileSystem().readFile(resource.getPath()) Buffer buffer = VertxHolder.getVertxInstance().fileSystem().readFileBlocking(resource.getPath());
.onSuccess(buffer -> { JsonObject entries = new JsonObject(buffer);
JsonObject entries = new JsonObject(buffer); Map<String, Object> map = entries.getMap();
Map<String, Object> map = entries.getMap(); LocalConstant.put(configName, map);
LocalConstant.put(configName, map); LOGGER.info("读取配置{}成功", configName);
LOGGER.info("读取配置{}成功", configName);
})
.onFailure(err -> LOGGER.error("读取配置{}失败", configName, err));
} }
public static <T> Set<T> sortClassSet(Set<Class<? extends T>> set) { public static <T> Set<T> sortClassSet(Set<Class<? extends T>> set) {