liurunyu
2 天以前 f8b2e59a82702a790c383a8ecd90c708c76e2488
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.dy.rtuMw.server.mqtt;
 
import com.dy.common.mw.protocol4Mqtt.MqttSubMsg;
import com.dy.common.queue.NodeObj;
import com.dy.common.springUtil.SpringContextUtil;
import com.dy.common.threadPool.ThreadPool;
import com.dy.common.threadPool.TreadPoolFactory;
import com.dy.rtuMw.web.comResult.CommandResultDeal;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
 
/**
 * @Author: liurunyu
 * @Date: 2025/6/5 15:06
 * @Description
 */
public class MqttComResultNode implements NodeObj {
 
    private static final Logger log = LogManager.getLogger(MqttComResultNode.class.getName());
 
    public Object obj ;//数据
 
    public MqttComResultNode(Object obj){
        this.obj = obj ;
    }
    /**
     * 自己处理自己
     * @return
     */
    public boolean dealSelf(){
        try {
            ThreadPool.Pool pool = TreadPoolFactory.getThreadPoolLong() ;
            pool.putJob(new ThreadPool.Job() {
                public void execute() {
                    if(obj != null){
                        if(obj instanceof MqttSubMsg){
                            CommandResultDeal deal = SpringContextUtil.getBean(CommandResultDeal.class) ;
                            deal.deal((MqttSubMsg)obj);
                        }
                    }
                }
                @Override
                public void destroy(){
                }
                @Override
                public boolean isDestroy(){
                    return false ;
                }
 
            });
        } catch (Exception e) {
            log.error("在RtuComResultNode内发生异常", e);
        }
        return true ;
    }
 
 
}