fix: ShutdownHook 接入 JDBCPoolInit.close() 和 JsParserExecutor.shutdownExecutor()

将已实现但未调用的 close()/shutdownExecutor() 接入 JVM ShutdownHook,显式释放资源。
关闭顺序:vertx.close() → JDBC 连接池 → WorkerExecutor 线程池,确保依赖关系正确。
This commit is contained in:
yukaidi
2026-05-29 00:50:45 +08:00
parent 1c2291f9cf
commit ab3009e9cc

View File

@@ -147,6 +147,18 @@ public final class Deploy {
} catch (Exception e) { } catch (Exception e) {
LOGGER.warn("Vert.x close error or timeout", e); LOGGER.warn("Vert.x close error or timeout", e);
} }
// 显式关闭 JDBC 连接池vertx.close 不保证关闭 JDBCPoolInit 管理的 pool
try {
cn.qaiu.db.pool.JDBCPoolInit.instance().close();
} catch (Exception e) {
LOGGER.warn("JDBC pool close error", e);
}
// 显式关闭 JS 解析器 WorkerExecutor 线程池
try {
cn.qaiu.parser.customjs.JsParserExecutor.shutdownExecutor();
} catch (Exception e) {
LOGGER.warn("JsParserExecutor shutdown error", e);
}
})); }));
//配置保存在共享数据中 //配置保存在共享数据中
var sharedData = vertx.sharedData(); var sharedData = vertx.sharedData();