| | |
| | | } |
| | | |
| | | /** |
| | | * 尝试设置 有界队列 容量 用于限制数量 |
| | | * |
| | | * @param queueName 队列名 |
| | | * @param capacity 容量 |
| | | */ |
| | | public static <T> boolean trySetBoundedQueueCapacity(String queueName, int capacity) { |
| | | RBoundedBlockingQueue<T> boundedBlockingQueue = CLIENT.getBoundedBlockingQueue(queueName); |
| | | return boundedBlockingQueue.trySetCapacity(capacity); |
| | | } |
| | | |
| | | /** |
| | | * 优先队列获取一个队列数据 没有数据返回 null(不支持延迟队列) |
| | | * |
| | | * @param queueName 队列名 |
| | |
| | | * |
| | | * @param queueName 队列名 |
| | | * @param capacity 容量 |
| | | */ |
| | | public static <T> boolean trySetBoundedQueueCapacity(String queueName, int capacity) { |
| | | RBoundedBlockingQueue<T> boundedBlockingQueue = CLIENT.getBoundedBlockingQueue(queueName); |
| | | return boundedBlockingQueue.trySetCapacity(capacity); |
| | | } |
| | | |
| | | /** |
| | | * 尝试设置 有界队列 容量 用于限制数量 |
| | | * |
| | | * @param queueName 队列名 |
| | | * @param capacity 容量 |
| | | * @param destroy 已存在是否销毁 |
| | | */ |
| | | public static <T> boolean trySetBoundedQueueCapacity(String queueName, int capacity, boolean destroy) { |