From ac2873bd37eeb496b0e9dd62d66e9fc4b38ef39b Mon Sep 17 00:00:00 2001 From: qirong <2032486488@qq.com> Date: 星期五, 22 十二月 2023 13:38:26 +0800 Subject: [PATCH] ftp摆渡 --- ruoyi-modules/ruoyi-demo/src/main/java/org/dromara/demo/controller/queue/BoundedQueueController.java | 184 +++++++++++++++++++++++----------------------- 1 files changed, 92 insertions(+), 92 deletions(-) diff --git a/ruoyi-modules/ruoyi-demo/src/main/java/org/dromara/demo/controller/queue/BoundedQueueController.java b/ruoyi-modules/ruoyi-demo/src/main/java/org/dromara/demo/controller/queue/BoundedQueueController.java index 30ec27f..c03aa6e 100644 --- a/ruoyi-modules/ruoyi-demo/src/main/java/org/dromara/demo/controller/queue/BoundedQueueController.java +++ b/ruoyi-modules/ruoyi-demo/src/main/java/org/dromara/demo/controller/queue/BoundedQueueController.java @@ -1,92 +1,92 @@ -package org.dromara.demo.controller.queue; - -import cn.dev33.satoken.annotation.SaIgnore; -import org.dromara.common.core.domain.R; -import org.dromara.common.redis.utils.QueueUtils; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.redisson.api.RBoundedBlockingQueue; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * 鏈夌晫闃熷垪 婕旂ず妗堜緥 - * <p> - * 杞婚噺绾ч槦鍒� 閲嶉噺绾ф暟鎹噺 璇蜂娇鐢� MQ - * <p> - * 闆嗙兢娴嬭瘯閫氳繃 鍚屼竴涓暟鎹彧浼氳娑堣垂涓�娆� 鍋氬ソ浜嬪姟琛ュ伩 - * 闆嗙兢娴嬭瘯娴佺▼ 鍦ㄥ叾涓竴鍙板彂閫佹暟鎹� 涓ょ鍒嗗埆璋冪敤鑾峰彇鎺ュ彛 涓�娆¤幏鍙栦竴鏉� - * - * @author Lion Li - * @version 3.6.0 - */ -@Slf4j -@RequiredArgsConstructor -@RestController -@RequestMapping("/demo/queue/bounded") -public class BoundedQueueController { - - - /** - * 娣诲姞闃熷垪鏁版嵁 - * - * @param queueName 闃熷垪鍚� - * @param capacity 瀹归噺 - */ - @GetMapping("/add") - public R<Void> add(String queueName, int capacity) { - // 鐢ㄥ畬浜嗕竴瀹氳閿�姣� 鍚﹀垯浼氫竴鐩村瓨鍦� - boolean b = QueueUtils.destroyBoundedQueue(queueName); - log.info("閫氶亾: {} , 鍒犻櫎: {}", queueName, b); - // 鍒濆鍖栬缃竴娆″嵆鍙� - if (QueueUtils.trySetBoundedQueueCapacity(queueName, capacity)) { - log.info("閫氶亾: {} , 璁剧疆瀹归噺: {}", queueName, capacity); - } else { - log.info("閫氶亾: {} , 璁剧疆瀹归噺澶辫触", queueName); - return R.fail("鎿嶄綔澶辫触"); - } - for (int i = 0; i < 11; i++) { - String data = "data-" + i; - boolean flag = QueueUtils.addBoundedQueueObject(queueName, data); - if (flag == false) { - log.info("閫氶亾: {} , 鍙戦�佹暟鎹�: {} 澶辫触, 閫氶亾宸叉弧", queueName, data); - } else { - log.info("閫氶亾: {} , 鍙戦�佹暟鎹�: {}", queueName, data); - } - } - return R.ok("鎿嶄綔鎴愬姛"); - } - - /** - * 鍒犻櫎闃熷垪鏁版嵁 - * - * @param queueName 闃熷垪鍚� - */ - @GetMapping("/remove") - public R<Void> remove(String queueName) { - String data = "data-" + 5; - if (QueueUtils.removeBoundedQueueObject(queueName, data)) { - log.info("閫氶亾: {} , 鍒犻櫎鏁版嵁: {}", queueName, data); - } else { - return R.fail("鎿嶄綔澶辫触"); - } - return R.ok("鎿嶄綔鎴愬姛"); - } - - /** - * 鑾峰彇闃熷垪鏁版嵁 - * - * @param queueName 闃熷垪鍚� - */ - @GetMapping("/get") - public R<Void> get(String queueName) { - String data; - do { - data = QueueUtils.getBoundedQueueObject(queueName); - log.info("閫氶亾: {} , 鑾峰彇鏁版嵁: {}", queueName, data); - } while (data != null); - return R.ok("鎿嶄綔鎴愬姛"); - } - -} +//package org.dromara.demo.controller.queue; +// +//import cn.dev33.satoken.annotation.SaIgnore; +//import org.dromara.common.core.domain.R; +//import org.dromara.common.redis.utils.QueueUtils; +//import lombok.RequiredArgsConstructor; +//import lombok.extern.slf4j.Slf4j; +//import org.redisson.api.RBoundedBlockingQueue; +//import org.springframework.web.bind.annotation.GetMapping; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RestController; +// +///** +// * 鏈夌晫闃熷垪 婕旂ず妗堜緥 +// * <p> +// * 杞婚噺绾ч槦鍒� 閲嶉噺绾ф暟鎹噺 璇蜂娇鐢� MQ +// * <p> +// * 闆嗙兢娴嬭瘯閫氳繃 鍚屼竴涓暟鎹彧浼氳娑堣垂涓�娆� 鍋氬ソ浜嬪姟琛ュ伩 +// * 闆嗙兢娴嬭瘯娴佺▼ 鍦ㄥ叾涓竴鍙板彂閫佹暟鎹� 涓ょ鍒嗗埆璋冪敤鑾峰彇鎺ュ彛 涓�娆¤幏鍙栦竴鏉� +// * +// * @author Lion Li +// * @version 3.6.0 +// */ +//@Slf4j +//@RequiredArgsConstructor +//@RestController +//@RequestMapping("/demo/queue/bounded") +//public class BoundedQueueController { +// +// +// /** +// * 娣诲姞闃熷垪鏁版嵁 +// * +// * @param queueName 闃熷垪鍚� +// * @param capacity 瀹归噺 +// */ +// @GetMapping("/add") +// public R<Void> add(String queueName, int capacity) { +// // 鐢ㄥ畬浜嗕竴瀹氳閿�姣� 鍚﹀垯浼氫竴鐩村瓨鍦� +// boolean b = QueueUtils.destroyBoundedQueue(queueName); +// log.info("閫氶亾: {} , 鍒犻櫎: {}", queueName, b); +// // 鍒濆鍖栬缃竴娆″嵆鍙� +// if (QueueUtils.trySetBoundedQueueCapacity(queueName, capacity)) { +// log.info("閫氶亾: {} , 璁剧疆瀹归噺: {}", queueName, capacity); +// } else { +// log.info("閫氶亾: {} , 璁剧疆瀹归噺澶辫触", queueName); +// return R.fail("鎿嶄綔澶辫触"); +// } +// for (int i = 0; i < 11; i++) { +// String data = "data-" + i; +// boolean flag = QueueUtils.addBoundedQueueObject(queueName, data); +// if (flag == false) { +// log.info("閫氶亾: {} , 鍙戦�佹暟鎹�: {} 澶辫触, 閫氶亾宸叉弧", queueName, data); +// } else { +// log.info("閫氶亾: {} , 鍙戦�佹暟鎹�: {}", queueName, data); +// } +// } +// return R.ok("鎿嶄綔鎴愬姛"); +// } +// +// /** +// * 鍒犻櫎闃熷垪鏁版嵁 +// * +// * @param queueName 闃熷垪鍚� +// */ +// @GetMapping("/remove") +// public R<Void> remove(String queueName) { +// String data = "data-" + 5; +// if (QueueUtils.removeBoundedQueueObject(queueName, data)) { +// log.info("閫氶亾: {} , 鍒犻櫎鏁版嵁: {}", queueName, data); +// } else { +// return R.fail("鎿嶄綔澶辫触"); +// } +// return R.ok("鎿嶄綔鎴愬姛"); +// } +// +// /** +// * 鑾峰彇闃熷垪鏁版嵁 +// * +// * @param queueName 闃熷垪鍚� +// */ +// @GetMapping("/get") +// public R<Void> get(String queueName) { +// String data; +// do { +// data = QueueUtils.getBoundedQueueObject(queueName); +// log.info("閫氶亾: {} , 鑾峰彇鏁版嵁: {}", queueName, data); +// } while (data != null); +// return R.ok("鎿嶄綔鎴愬姛"); +// } +// +//} -- Gitblit v1.8.0