KAKO_Reader.java
1.3 KB
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
package com.sy.IMF;
import com.caac.imf.api.IMFClient;
import com.sy.controller.AnalysisRoute;
import org.apache.log4j.Logger;
public class KAKO_Reader extends Thread{
    protected static final Logger logger = Logger.getLogger(KAKO_Reader.class);
    private IMFClient client;
    public static  boolean isrunning;
    public KAKO_Reader(IMFClient client) {
        this.client = client;
    }
    public void run() {
        try{
            isrunning =true;
            while(true) {
                if (IMF_Tesk.LOGIN_OK) synchronized (this) {
                    String message = this.client.getMSG();
                    if (message != null) {
                        logger.info(message);
                        AnalysisRoute route = new AnalysisRoute();
                        route.analysis(message);
                    }
                }
                else {
                    //logger.info("***");
                }
                try {
                    Thread.sleep(1000L);
                } catch (InterruptedException var3) {
                    var3.printStackTrace();
                }
            }
        }catch (Exception e){
            isrunning=false;
            logger.info("****************读取线程不在了****************");
        }
    }
}