update 优化 销毁策略

This commit is contained in:
疯狂的狮子Li 2024-11-29 16:21:19 +08:00
parent 476c7a77c8
commit 99d9c516fc

View File

@ -174,11 +174,11 @@ public class QueueUtils {
* *
* @param queueName 队列名 * @param queueName 队列名
* @param capacity 容量 * @param capacity 容量
* @param destroy 已存在是否销毁 * @param destroy 是否销毁
*/ */
public static <T> boolean trySetBoundedQueueCapacity(String queueName, int capacity, boolean destroy) { public static <T> boolean trySetBoundedQueueCapacity(String queueName, int capacity, boolean destroy) {
RBoundedBlockingQueue<T> boundedBlockingQueue = CLIENT.getBoundedBlockingQueue(queueName); RBoundedBlockingQueue<T> boundedBlockingQueue = CLIENT.getBoundedBlockingQueue(queueName);
if (boundedBlockingQueue.isExists() && destroy) { if (destroy) {
destroyQueue(queueName); destroyQueue(queueName);
} }
return boundedBlockingQueue.trySetCapacity(capacity); return boundedBlockingQueue.trySetCapacity(capacity);