ThreadMonotor.java 1.3 KB
package com.bsth.data;

import com.bsth.data.gpsdata.arrival.GpsRealAnalyse;
import com.bsth.data.gpsdata.thread.GpsDataLoaderThread;
import com.bsth.data.msg_queue.DirectivePushQueue;
import com.bsth.data.msg_queue.WebSocketPushQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * Created by panzhao on 2017/5/11.
 */
@Component
public class ThreadMonotor extends Thread{

    Logger log = LoggerFactory.getLogger(this.getClass());

    @Override
    public void run() {

        //线调GPS分析主线程
        if(GpsRealAnalyse.isBlock()){
            log.warn("GpsRealAnalyse isBlock true !!!!");
            GpsRealAnalyse.shutdown();
        }

        if(GpsRealAnalyse.isIdle()){
            //切换到备用的网关实时GPS对照数据
            GpsDataLoaderThread.setFlag(-1);
        }

        //webSocket 消息推送队列
        if(WebSocketPushQueue.isIdle()){
            log.warn("WebSocketPushQueue isIdle true !!!!");
            WebSocketPushQueue.start();
        }

        //网关指令推送队列(系统自动发送的)
        if(DirectivePushQueue.isIdle()){
            log.warn("DirectivePushQueue isIdle true !!!!");
            DirectivePushQueue.start();
        }
    }
}