This commit is contained in:
2026-04-17 10:32:57 +08:00
parent 572ad1205f
commit 17c52c978c
691 changed files with 72342 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
package com.maibu.netty;
import com.fastbee.memory.MiddleGlobalMemory;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import lombok.Getter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
/**
* 系统初始化资源类
* 实现CommandLineRunner接口,在Spring Boot启动时自动执行
*/
@Getter
@Component
public class InitResource implements CommandLineRunner {
private static final Logger logger = LoggerFactory.getLogger(InitResource.class);
@Override
public void run(String... args) throws Exception {
logger.info("InitResource 开始初始化系统资源...");
// 初始化Vert.x
initVertx();
logger.info("InitResource 系统资源初始化完成");
}
/**
* 初始化Vert.x
*/
private void initVertx() {
try {
VertxOptions options = new VertxOptions()
.setWorkerPoolSize(20)
.setEventLoopPoolSize(10)
.setWarningExceptionTime(5000000000L);
MiddleGlobalMemory.vertx = Vertx.vertx(options);
logger.info("Vert.x 初始化成功");
} catch (Exception e) {
logger.error("Vert.x 初始化失败: {}", e.getMessage(), e);
}
}
}