liurunyu
2024-06-28 4fe7ea4fbdc0c45f14d1d8de77e3424f826ba909
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
package com.dy.rtuMw.server.rtuData;
 
import com.dy.rtuMw.web.comResult.CommandResultDeal;
import com.dy.common.mw.protocol.Data;
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 org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
 
public class RtuComResultNode implements NodeObj {
 
    private static final Logger log = LogManager.getLogger(RtuComResultNode.class.getName());
 
    public Object obj ;//数据
 
    public RtuComResultNode(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 Data){
                            CommandResultDeal deal = (CommandResultDeal) SpringContextUtil.getBean(CommandResultDeal.class) ;
                            deal.deal((Data)obj);
                        }
                    }
                }
                @Override
                public void destroy(){
                }
                @Override
                public boolean isDestroy(){
                    return false ;
                }
 
            });
        } catch (Exception e) {
            log.error("在RtuComResultNode内发生异常", e);
        }
        return true ;
    }
 
 
}