zwl
2025-07-02 4282d15a5e69a6b4c822c87d27a1ed6e7e618f00
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;
    }
}