- 将 item-nbt-api 从 2.15.1 更新至 2.15.3 - 将 adventure-platform-bukkit 从 4.3.2 更新至 4.4.1 - 将 adventure-text-minimessage 从 4.15.0 更新至 4.25.0 - 升级项目版本号从 1.4.2 至 1.4.3 - 在各模块配置文件中新增线程池大小配置项 - 根据配置动态设置普通任务和定时任务线程池大小 - 默认线程池大小分别为 10 和 5,并支持自定义配置
This commit is contained in:
@@ -5,7 +5,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = "cn.hamster3.mc.plugin"
|
||||
version = "1.4.2"
|
||||
version = "1.4.3"
|
||||
description = "叁只仓鼠的 Minecraft 插件开发通用工具包"
|
||||
|
||||
subprojects {
|
||||
|
||||
@@ -14,14 +14,14 @@ dependencies {
|
||||
compileOnly("me.clip:placeholderapi:2.11.5") { isTransitive = false }
|
||||
|
||||
// https://www.spigotmc.org/resources/nbt-api.7939/
|
||||
implementation("de.tr7zw:item-nbt-api:2.15.1")
|
||||
implementation("de.tr7zw:item-nbt-api:2.15.3")
|
||||
|
||||
api("net.kyori:adventure-platform-bukkit:4.3.2") {
|
||||
api("net.kyori:adventure-platform-bukkit:4.4.1") {
|
||||
exclude(group = "org.jetbrains")
|
||||
exclude(group = "com.google.code.gson")
|
||||
exclude(group = "io.netty")
|
||||
}
|
||||
api("net.kyori:adventure-text-minimessage:4.15.0") {
|
||||
api("net.kyori:adventure-text-minimessage:4.25.0") {
|
||||
exclude(module = "adventure-api")
|
||||
exclude(group = "org.jetbrains")
|
||||
exclude(group = "io.netty")
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
# 普通任务执行线程池大小
|
||||
# 建议设置为玩家数 / 5,但不小于 10
|
||||
executor-thread-pool-size: 10
|
||||
|
||||
# 定时任务执行线程池大小
|
||||
# 建议设置为玩家数 / 10,但不小于 5
|
||||
scheduler-thread-pool-size: 5
|
||||
|
||||
# 是否启用 redis 连接池功能
|
||||
enable-redis: false
|
||||
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
# 普通任务执行线程池大小
|
||||
# 建议设置为玩家数 / 5,但不小于 10
|
||||
executor-thread-pool-size: 10
|
||||
|
||||
# 定时任务执行线程池大小
|
||||
# 建议设置为玩家数 / 10,但不小于 5
|
||||
scheduler-thread-pool-size: 5
|
||||
|
||||
# 是否启用 redis 连接池功能
|
||||
enable-redis: false
|
||||
|
||||
|
||||
@@ -57,8 +57,14 @@ public abstract class CoreAPI {
|
||||
|
||||
public CoreAPI(@NotNull ConfigSection config) {
|
||||
SimpleLogger logger = getLogger();
|
||||
executorService = Executors.newCachedThreadPool(new NamedThreadFactory("HamsterCore - Executor"));
|
||||
scheduledService = Executors.newScheduledThreadPool(1, new NamedThreadFactory("HamsterCore - Scheduler"));
|
||||
executorService = Executors.newFixedThreadPool(
|
||||
config.getInt("executor-thread-pool-size", 10),
|
||||
new NamedThreadFactory("HamsterCore - Executor")
|
||||
);
|
||||
scheduledService = Executors.newScheduledThreadPool(
|
||||
config.getInt("scheduler-thread-pool-size", 5),
|
||||
new NamedThreadFactory("HamsterCore - Scheduler")
|
||||
);
|
||||
logger.info("已创建线程池");
|
||||
|
||||
enableRedis = config.getBoolean("enable-redis", true);
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
# 普通任务执行线程池大小
|
||||
# 建议设置为玩家数 / 5,但不小于 10
|
||||
executor-thread-pool-size: 10
|
||||
|
||||
# 定时任务执行线程池大小
|
||||
# 建议设置为玩家数 / 10,但不小于 5
|
||||
scheduler-thread-pool-size: 5
|
||||
|
||||
# 是否启用 redis 连接池功能
|
||||
enable-redis: false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user