From 9afe6ec9eeae0bc2a692ef8812f75fff0e7cc621 Mon Sep 17 00:00:00 2001 From: huangyb Date: Tue, 7 Jun 2022 11:56:27 +0800 Subject: [PATCH] =?UTF-8?q?ResizableCapacityLinkedBlockIngQueue=20?= =?UTF-8?q?=E7=B1=BB=E5=90=8D=E6=8B=BC=E5=86=99=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=20ResizableCapacityLinkedBlockingQueue=EF=BC=8C=E6=9B=B4?= =?UTF-8?q?=E5=8A=A0=E7=AC=A6=E5=90=88=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/hippo4j/core/executor/support/QueueTypeEnum.java | 2 +- ...Queue.java => ResizableCapacityLinkedBlockingQueue.java} | 4 ++-- .../starter/refresher/event/ExecutorsListener.java | 6 +++--- .../starter/core/ServerThreadPoolDynamicRefresh.java | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) rename hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/{ResizableCapacityLinkedBlockIngQueue.java => ResizableCapacityLinkedBlockingQueue.java} (93%) diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/QueueTypeEnum.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/QueueTypeEnum.java index e9375f2e..b05b21ec 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/QueueTypeEnum.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/QueueTypeEnum.java @@ -129,7 +129,7 @@ public enum QueueTypeEnum { } else if (Objects.equals(type, PRIORITY_BLOCKING_QUEUE.type)) { blockingQueue = new PriorityBlockingQueue(capacity); } else if (Objects.equals(type, RESIZABLE_LINKED_BLOCKING_QUEUE.type)) { - blockingQueue = new ResizableCapacityLinkedBlockIngQueue(capacity); + blockingQueue = new ResizableCapacityLinkedBlockingQueue(capacity); } Collection customBlockingQueues = DynamicThreadPoolServiceLoader .getSingletonServiceInstances(CustomBlockingQueue.class); diff --git a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ResizableCapacityLinkedBlockIngQueue.java b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ResizableCapacityLinkedBlockingQueue.java similarity index 93% rename from hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ResizableCapacityLinkedBlockIngQueue.java rename to hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ResizableCapacityLinkedBlockingQueue.java index 60fb7f9f..8040f93f 100644 --- a/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ResizableCapacityLinkedBlockIngQueue.java +++ b/hippo4j-core/src/main/java/cn/hippo4j/core/executor/support/ResizableCapacityLinkedBlockingQueue.java @@ -30,9 +30,9 @@ import java.util.concurrent.atomic.AtomicInteger; * @date 2021/6/20 14:24 */ @Slf4j -public class ResizableCapacityLinkedBlockIngQueue extends LinkedBlockingQueue { +public class ResizableCapacityLinkedBlockingQueue extends LinkedBlockingQueue { - public ResizableCapacityLinkedBlockIngQueue(int capacity) { + public ResizableCapacityLinkedBlockingQueue(int capacity) { super(capacity); } diff --git a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/ExecutorsListener.java b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/ExecutorsListener.java index 0ebacb8f..04d6c9bf 100644 --- a/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/ExecutorsListener.java +++ b/hippo4j-spring-boot/hippo4j-core-spring-boot-starter/src/main/java/cn/hippo4j/core/springboot/starter/refresher/event/ExecutorsListener.java @@ -24,7 +24,7 @@ import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage; import cn.hippo4j.core.executor.support.AbstractDynamicExecutorSupport; import cn.hippo4j.core.executor.support.QueueTypeEnum; import cn.hippo4j.core.executor.support.RejectedTypeEnum; -import cn.hippo4j.core.executor.support.ResizableCapacityLinkedBlockIngQueue; +import cn.hippo4j.core.executor.support.ResizableCapacityLinkedBlockingQueue; import cn.hippo4j.core.proxy.RejectedProxyUtil; import cn.hippo4j.core.springboot.starter.config.BootstrapCoreProperties; import cn.hippo4j.core.springboot.starter.config.ExecutorProperties; @@ -188,8 +188,8 @@ public class ExecutorsListener implements ApplicationListener queue = (ResizableCapacityLinkedBlockIngQueue) executor.getQueue(); + if (executor.getQueue() instanceof ResizableCapacityLinkedBlockingQueue) { + ResizableCapacityLinkedBlockingQueue queue = (ResizableCapacityLinkedBlockingQueue) executor.getQueue(); queue.setCapacity(properties.getQueueCapacity()); } else { log.warn("The queue length cannot be modified. Queue type mismatch. Current queue type :: {}", executor.getQueue().getClass().getSimpleName()); diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/ServerThreadPoolDynamicRefresh.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/ServerThreadPoolDynamicRefresh.java index 10974472..ff7a3120 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/ServerThreadPoolDynamicRefresh.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter/src/main/java/cn/hippo4j/springboot/starter/core/ServerThreadPoolDynamicRefresh.java @@ -28,7 +28,7 @@ import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage; import cn.hippo4j.core.executor.support.AbstractDynamicExecutorSupport; import cn.hippo4j.core.executor.support.QueueTypeEnum; import cn.hippo4j.core.executor.support.RejectedTypeEnum; -import cn.hippo4j.core.executor.support.ResizableCapacityLinkedBlockIngQueue; +import cn.hippo4j.core.executor.support.ResizableCapacityLinkedBlockingQueue; import cn.hippo4j.core.proxy.RejectedProxyUtil; import cn.hippo4j.common.api.ThreadPoolDynamicRefresh; import lombok.AllArgsConstructor; @@ -148,8 +148,8 @@ public class ServerThreadPoolDynamicRefresh implements ThreadPoolDynamicRefresh } if (parameter.getCapacity() != null && Objects.equals(QueueTypeEnum.RESIZABLE_LINKED_BLOCKING_QUEUE.type, parameter.getQueueType())) { - if (executor.getQueue() instanceof ResizableCapacityLinkedBlockIngQueue) { - ResizableCapacityLinkedBlockIngQueue queue = (ResizableCapacityLinkedBlockIngQueue) executor.getQueue(); + if (executor.getQueue() instanceof ResizableCapacityLinkedBlockingQueue) { + ResizableCapacityLinkedBlockingQueue queue = (ResizableCapacityLinkedBlockingQueue) executor.getQueue(); queue.setCapacity(parameter.getCapacity()); } else { log.warn("The queue length cannot be modified. Queue type mismatch. Current queue type :: {}", executor.getQueue().getClass().getSimpleName());