From 9f08423b5b6f3c2a72b2151235723943833490d1 Mon Sep 17 00:00:00 2001
From: mingri31164 <3116430062@qq.com>
Date: Wed, 22 Oct 2025 15:51:50 +0800
Subject: [PATCH] Add custom SPI blocking queue type support
---
.../core/ServerThreadPoolDynamicRefresh.java | 1 -
threadpool/console/src/locale/lang/en.js | 2 +
threadpool/console/src/locale/lang/zh.js | 2 +
.../src/views/hippo4j/instance/index.vue | 3 +
.../src/views/hippo4j/monitor/index.vue | 2 +
.../src/views/hippo4j/threadpool/index.vue | 65 +++++++++++++++++++
.../src/views/hippo4j/verify/index.vue | 2 +
7 files changed, 76 insertions(+), 1 deletion(-)
diff --git a/starters/threadpool/server/src/main/java/cn/hippo4j/springboot/starter/core/ServerThreadPoolDynamicRefresh.java b/starters/threadpool/server/src/main/java/cn/hippo4j/springboot/starter/core/ServerThreadPoolDynamicRefresh.java
index 4c4fd552..739607d4 100644
--- a/starters/threadpool/server/src/main/java/cn/hippo4j/springboot/starter/core/ServerThreadPoolDynamicRefresh.java
+++ b/starters/threadpool/server/src/main/java/cn/hippo4j/springboot/starter/core/ServerThreadPoolDynamicRefresh.java
@@ -22,7 +22,6 @@ import cn.hippo4j.common.executor.ThreadPoolExecutorRegistry;
import cn.hippo4j.common.executor.support.BlockingQueueTypeEnum;
import cn.hippo4j.common.executor.support.BlockingQueueManager;
import cn.hippo4j.common.executor.support.RejectedPolicyTypeEnum;
-import cn.hippo4j.common.executor.support.ResizableCapacityLinkedBlockingQueue;
import cn.hippo4j.common.extension.enums.EnableEnum;
import cn.hippo4j.common.model.ThreadPoolParameter;
import cn.hippo4j.common.model.ThreadPoolParameterInfo;
diff --git a/threadpool/console/src/locale/lang/en.js b/threadpool/console/src/locale/lang/en.js
index 0cce96bc..19dcfa6e 100644
--- a/threadpool/console/src/locale/lang/en.js
+++ b/threadpool/console/src/locale/lang/en.js
@@ -106,6 +106,8 @@ export default {
capacityAlarm: 'Capacity Alarm',
customRejectedHandler: 'Custom Rejected Handler',
customRejectedHandlerTip: 'Please enter a custom SPI Deny Policy ID',
+ customQueueType: 'Custom Queue Type',
+ customQueueTypeTip: 'Please enter a custom SPI Queue ID',
threadsNumErrorTip: 'The maximum thread must be greater than or equal to the core thread',
},
diff --git a/threadpool/console/src/locale/lang/zh.js b/threadpool/console/src/locale/lang/zh.js
index 1cc9dc6c..af395bde 100644
--- a/threadpool/console/src/locale/lang/zh.js
+++ b/threadpool/console/src/locale/lang/zh.js
@@ -104,6 +104,8 @@ export default {
capacityAlarm: '容量报警',
customRejectedHandler: '自定义拒绝策略',
customRejectedHandlerTip: '请输入自定义 SPI 拒绝策略标识',
+ customQueueType: '自定义队列类型',
+ customQueueTypeTip: '请输入自定义 SPI 队列标识',
threadsNumErrorTip: '最大线程必须大于等于核心线程',
},
diff --git a/threadpool/console/src/views/hippo4j/instance/index.vue b/threadpool/console/src/views/hippo4j/instance/index.vue
index 456757de..c7ded8a1 100755
--- a/threadpool/console/src/views/hippo4j/instance/index.vue
+++ b/threadpool/console/src/views/hippo4j/instance/index.vue
@@ -459,6 +459,8 @@ export default {
return 'PriorityBlockingQueue';
} else if ('9' == type) {
return 'ResizableLinkedBlockingQueue';
+ } else {
+ return 'CustomBlockingQueue_' + type;
}
},
@@ -516,6 +518,7 @@ export default {
key: 9,
display_name: 'ResizableLinkedBlockingQueue (动态修改队列大小)',
},
+ { key: 99, display_name: 'CustomBlockingQueue(自定义 SPI 队列)' },
],
rejectedOptions: [
{ key: 1, display_name: 'CallerRunsPolicy' },
diff --git a/threadpool/console/src/views/hippo4j/monitor/index.vue b/threadpool/console/src/views/hippo4j/monitor/index.vue
index d6d1a42d..fefe1c99 100644
--- a/threadpool/console/src/views/hippo4j/monitor/index.vue
+++ b/threadpool/console/src/views/hippo4j/monitor/index.vue
@@ -426,6 +426,8 @@ export default {
return 'PriorityBlockingQueue';
} else if ('9' == type) {
return 'ResizableLinkedBlockingQueue';
+ } else {
+ return 'CustomBlockingQueue_' + type;
}
},
}
diff --git a/threadpool/console/src/views/hippo4j/threadpool/index.vue b/threadpool/console/src/views/hippo4j/threadpool/index.vue
index a832b389..4bdd5fb5 100755
--- a/threadpool/console/src/views/hippo4j/threadpool/index.vue
+++ b/threadpool/console/src/views/hippo4j/threadpool/index.vue
@@ -231,6 +231,17 @@
/>
+
+
+
{
this.fetchData();
this.dialogFormVisible = false;
@@ -666,6 +693,25 @@ export default {
} else {
this.isRejectShow = false;
}
+
+ // 处理自定义队列类型
+ let queueType = this.temp.queueType;
+ if (
+ queueType != 1 &&
+ queueType != 2 &&
+ queueType != 3 &&
+ queueType != 4 &&
+ queueType != 5 &&
+ queueType != 6 &&
+ queueType != 9
+ ) {
+ this.isQueueShow = true;
+ this.temp.customQueueType = this.temp.queueType;
+ this.temp.queueType = 99;
+ } else {
+ this.isQueueShow = false;
+ }
+
this.dialogStatus = 'update';
this.dialogFormVisible = true;
this.isEdit = false;
@@ -697,6 +743,23 @@ export default {
this.temp.rejectedType = this.temp.customRejectedType;
}
}
+
+ // 处理自定义队列类型
+ let queueType = this.temp.queueType;
+ if (
+ queueType != 1 &&
+ queueType != 2 &&
+ queueType != 3 &&
+ queueType != 4 &&
+ queueType != 5 &&
+ queueType != 6 &&
+ queueType != 9
+ ) {
+ if (this.temp.customQueueType != null) {
+ this.temp.queueType = this.temp.customQueueType;
+ }
+ }
+
const tempData = Object.assign({}, this.temp);
threadPoolApi.updated(tempData).then(() => {
this.fetchData();
@@ -743,6 +806,8 @@ export default {
} else if (value === 5) {
this.temp.capacity = 2147483647;
}
+ // 判断是否显示自定义队列输入框
+ this.isQueueShow = value === 99 ? true : false;
this.$forceUpdate();
},
diff --git a/threadpool/console/src/views/hippo4j/verify/index.vue b/threadpool/console/src/views/hippo4j/verify/index.vue
index db183093..e15ee48f 100644
--- a/threadpool/console/src/views/hippo4j/verify/index.vue
+++ b/threadpool/console/src/views/hippo4j/verify/index.vue
@@ -351,6 +351,8 @@ export default {
return 'PriorityBlockingQueue';
} else if ('9' == type) {
return 'ResizableLinkedBlockingQueue';
+ } else {
+ return 'CustomBlockingQueue_' + type;
}
},
rejectedTypeFilter(type) {