IMF_Reader.java 1.4 KB
package com.tianbo.imf;

import com.caac.imf.api.IMFClient;

import com.tianbo.util.IO.FileTool;
import com.tianbo.Main;
import org.apache.log4j.Logger;

public class IMF_Reader extends Thread{
    protected static final Logger logger = Logger.getLogger(IMF_Reader.class);
    private IMFClient client;
    public static  boolean isrunning;

    public IMF_Reader(IMFClient client) {
        this.client = client;
    }

    public void run() {
        try{
            isrunning =true;
            while(true) {
                if (Main.LOGIN_OK) {
                        String message = this.client.getMSG();
                        if (message != null) {
                            FileTool.writeFileToBak(message);
//                            IMF_Message_MainHandle mainHandle = new IMF_Message_MainHandle();
//                            IMF_META meta = mainHandle.messageHandle(message);
                        }
                        //logger.info("当前线程:"+Thread.currentThread().getName());
                } else {
                    //logger.info("***");
                }

                try {
                    Thread.sleep(500L);
                } catch (InterruptedException var3) {
                    var3.printStackTrace();

                }
            }

        }catch (Exception e){
            e.printStackTrace();
        }
        isrunning=false;
        logger.info("****************读取线程不在了****************");
    }
}