From 8b9b604e379f92dc61fb55e1454b7f1d107428d9 Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期一, 16 六月 2025 16:14:17 +0800 Subject: [PATCH] 1 --- src/main/java/com/zy/core/cache/MessageQueue.java | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zy/core/cache/MessageQueue.java b/src/main/java/com/zy/core/cache/MessageQueue.java index b98b430..301dd52 100644 --- a/src/main/java/com/zy/core/cache/MessageQueue.java +++ b/src/main/java/com/zy/core/cache/MessageQueue.java @@ -1,6 +1,5 @@ package com.zy.core.cache; -import com.zy.asrs.utils.CommandUtils; import com.zy.core.Slave; import com.zy.core.enums.SlaveType; import com.zy.core.model.Task; @@ -125,10 +124,10 @@ } } - public static void clear(SlaveType type, Integer id){ + public static void clear(SlaveType type, Integer id) { switch (type) { case Crn: - + CRN_EXCHANGE.get(id).clear(); break; case Devp: @@ -150,5 +149,20 @@ break; } } + public static boolean offer(SlaveType type, Integer devpId, Task task, Runnable callback) { + boolean result = offer(type, devpId, task); // 鍏堟墽琛屽師鏈変换鍔¢�昏緫 + if (result && callback != null) { + new Thread(() -> { + try { + Thread.sleep(200); // 妯℃嫙浠诲姟鎵ц鏃堕棿 + callback.run(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + }).start(); + } + return result; + } + } -- Gitblit v1.9.1