ResizableCapacityLinkedBlockIngQueue 类名拼写修改为 ResizableCapacityLinkedBlockingQueue,更加符合规范

pull/256/head
huangyb 3 years ago
parent 59c15dba5d
commit b2e9f46db2

@ -130,7 +130,7 @@ public enum QueueTypeEnum {
} else if (Objects.equals(type, PRIORITY_BLOCKING_QUEUE.type)) { } else if (Objects.equals(type, PRIORITY_BLOCKING_QUEUE.type)) {
blockingQueue = new PriorityBlockingQueue(capacity); blockingQueue = new PriorityBlockingQueue(capacity);
} else if (Objects.equals(type, RESIZABLE_LINKED_BLOCKING_QUEUE.type)) { } else if (Objects.equals(type, RESIZABLE_LINKED_BLOCKING_QUEUE.type)) {
blockingQueue = new ResizableCapacityLinkedBlockIngQueue(capacity); blockingQueue = new ResizableCapacityLinkedBlockingQueue(capacity);
} }
Collection<CustomBlockingQueue> customBlockingQueues = DynamicThreadPoolServiceLoader Collection<CustomBlockingQueue> customBlockingQueues = DynamicThreadPoolServiceLoader

@ -13,9 +13,9 @@ import java.util.concurrent.atomic.AtomicInteger;
* @date 2021/6/20 14:24 * @date 2021/6/20 14:24
*/ */
@Slf4j @Slf4j
public class ResizableCapacityLinkedBlockIngQueue<E> extends LinkedBlockingQueue<E> { public class ResizableCapacityLinkedBlockingQueue<E> extends LinkedBlockingQueue<E> {
public ResizableCapacityLinkedBlockIngQueue(int capacity) { public ResizableCapacityLinkedBlockingQueue(int capacity) {
super(capacity); super(capacity);
} }

@ -282,8 +282,8 @@ public abstract class AbstractCoreThreadPoolDynamicRefresh implements ThreadPool
if (!Objects.equals(beforeProperties.getQueueCapacity(), properties.getQueueCapacity()) if (!Objects.equals(beforeProperties.getQueueCapacity(), properties.getQueueCapacity())
&& Objects.equals(QueueTypeEnum.RESIZABLE_LINKED_BLOCKING_QUEUE.name, executor.getQueue().getClass().getSimpleName())) { && Objects.equals(QueueTypeEnum.RESIZABLE_LINKED_BLOCKING_QUEUE.name, executor.getQueue().getClass().getSimpleName())) {
if (executor.getQueue() instanceof ResizableCapacityLinkedBlockIngQueue) { if (executor.getQueue() instanceof ResizableCapacityLinkedBlockingQueue) {
ResizableCapacityLinkedBlockIngQueue queue = (ResizableCapacityLinkedBlockIngQueue) executor.getQueue(); ResizableCapacityLinkedBlockingQueue queue = (ResizableCapacityLinkedBlockingQueue) executor.getQueue();
queue.setCapacity(properties.getQueueCapacity()); queue.setCapacity(properties.getQueueCapacity());
} else { } else {
log.warn("The queue length cannot be modified. Queue type mismatch. Current queue type :: {}", executor.getQueue().getClass().getSimpleName()); log.warn("The queue length cannot be modified. Queue type mismatch. Current queue type :: {}", executor.getQueue().getClass().getSimpleName());

@ -11,7 +11,7 @@ import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage;
import cn.hippo4j.core.executor.support.AbstractDynamicExecutorSupport; import cn.hippo4j.core.executor.support.AbstractDynamicExecutorSupport;
import cn.hippo4j.core.executor.support.QueueTypeEnum; import cn.hippo4j.core.executor.support.QueueTypeEnum;
import cn.hippo4j.core.executor.support.RejectedTypeEnum; 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.proxy.RejectedProxyUtil;
import cn.hippo4j.common.api.ThreadPoolDynamicRefresh; import cn.hippo4j.common.api.ThreadPoolDynamicRefresh;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -133,8 +133,8 @@ public class ServerThreadPoolDynamicRefresh implements ThreadPoolDynamicRefresh
if (parameter.getCapacity() != null if (parameter.getCapacity() != null
&& Objects.equals(QueueTypeEnum.RESIZABLE_LINKED_BLOCKING_QUEUE.type, parameter.getQueueType())) { && Objects.equals(QueueTypeEnum.RESIZABLE_LINKED_BLOCKING_QUEUE.type, parameter.getQueueType())) {
if (executor.getQueue() instanceof ResizableCapacityLinkedBlockIngQueue) { if (executor.getQueue() instanceof ResizableCapacityLinkedBlockingQueue) {
ResizableCapacityLinkedBlockIngQueue queue = (ResizableCapacityLinkedBlockIngQueue) executor.getQueue(); ResizableCapacityLinkedBlockingQueue queue = (ResizableCapacityLinkedBlockingQueue) executor.getQueue();
queue.setCapacity(parameter.getCapacity()); queue.setCapacity(parameter.getCapacity());
} else { } else {
log.warn("The queue length cannot be modified. Queue type mismatch. Current queue type :: {}", executor.getQueue().getClass().getSimpleName()); log.warn("The queue length cannot be modified. Queue type mismatch. Current queue type :: {}", executor.getQueue().getClass().getSimpleName());

@ -4,7 +4,7 @@ import cn.hippo4j.common.model.PoolRunStateInfo;
import cn.hippo4j.common.toolkit.JSONUtil; import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage; import cn.hippo4j.core.executor.manage.GlobalThreadPoolManage;
import cn.hippo4j.starter.monitor.collect.RunTimeInfoCollector; import cn.hippo4j.starter.monitor.collect.RunTimeInfoCollector;
import cn.hippo4j.core.executor.support.ResizableCapacityLinkedBlockIngQueue; import cn.hippo4j.core.executor.support.ResizableCapacityLinkedBlockingQueue;
import cn.hippo4j.core.executor.support.ThreadFactoryBuilder; import cn.hippo4j.core.executor.support.ThreadFactoryBuilder;
import cn.hippo4j.core.executor.support.ThreadPoolBuilder; import cn.hippo4j.core.executor.support.ThreadPoolBuilder;
import cn.hippo4j.common.toolkit.ThreadUtil; import cn.hippo4j.common.toolkit.ThreadUtil;
@ -34,7 +34,7 @@ public class MonitorPerformanceTest {
.dynamicPool() .dynamicPool()
.threadFactory(TEST_FLAG) .threadFactory(TEST_FLAG)
.poolThreadSize(5, 10) .poolThreadSize(5, 10)
.workQueue(new ResizableCapacityLinkedBlockIngQueue(1024)) .workQueue(new ResizableCapacityLinkedBlockingQueue(1024))
.rejected(new ThreadPoolExecutor.AbortPolicy()) .rejected(new ThreadPoolExecutor.AbortPolicy())
.build(); .build();
@ -42,7 +42,7 @@ public class MonitorPerformanceTest {
.dynamicPool() .dynamicPool()
.threadFactory("dynamic.thread.pool") .threadFactory("dynamic.thread.pool")
.poolThreadSize(5, 10) .poolThreadSize(5, 10)
.workQueue(new ResizableCapacityLinkedBlockIngQueue(1024)) .workQueue(new ResizableCapacityLinkedBlockingQueue(1024))
.rejected(new ThreadPoolExecutor.AbortPolicy()) .rejected(new ThreadPoolExecutor.AbortPolicy())
.build(); .build();

@ -1,6 +1,6 @@
package cn.hippo4j.starter.test; package cn.hippo4j.starter.test;
import cn.hippo4j.core.executor.support.ResizableCapacityLinkedBlockIngQueue; import cn.hippo4j.core.executor.support.ResizableCapacityLinkedBlockingQueue;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
@ -17,7 +17,7 @@ import java.util.concurrent.TimeUnit;
public class ResizableCapacityLinkedBlockIngQueueTest { public class ResizableCapacityLinkedBlockIngQueueTest {
public static void main(String[] args) throws InterruptedException { public static void main(String[] args) throws InterruptedException {
ResizableCapacityLinkedBlockIngQueue blockIngQueue = new ResizableCapacityLinkedBlockIngQueue(5); ResizableCapacityLinkedBlockingQueue blockIngQueue = new ResizableCapacityLinkedBlockingQueue(5);
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1,
3, 3,
1024, 1024,

Loading…
Cancel
Save