mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-06-10 23:47:29 +00:00
fix(resource): ReqIpUtil 使用统一 Vertx 单例
原代码在字段级别直接创建 Vertx.vertx() 实例, 可能导致多个 Vertx 实例重复创建,浪费系统资源。 改为使用 WebClientVertxInit.get() 获取统一单例。
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package cn.qaiu.util;
|
||||
|
||||
import cn.qaiu.WebClientVertxInit;
|
||||
import io.vertx.core.AsyncResult;
|
||||
import io.vertx.core.MultiMap;
|
||||
import io.vertx.core.Vertx;
|
||||
@@ -43,11 +44,11 @@ public class ReqIpUtil {
|
||||
|
||||
}
|
||||
|
||||
|
||||
Vertx vertx = Vertx.vertx();
|
||||
WebClient webClient = WebClient.create(vertx);
|
||||
// 使用统一的 Vertx 单例,避免重复创建实例
|
||||
private final Vertx vertx = WebClientVertxInit.get();
|
||||
private final WebClient webClient = WebClient.create(vertx);
|
||||
// 发送GET请求
|
||||
WebClientSession webClientSession = WebClientSession.create(webClient);
|
||||
private final WebClientSession webClientSession = WebClientSession.create(webClient);
|
||||
|
||||
|
||||
public void exec() {
|
||||
|
||||
Reference in New Issue
Block a user