Commit 708193c5631338da52772f3c572a092813e23be4
1 parent
f47e8872
update...
Showing
2 changed files
with
10 additions
and
0 deletions
src/main/java/com/bsth/data/ThreadMonotor.java
| 1 | package com.bsth.data; | 1 | package com.bsth.data; |
| 2 | 2 | ||
| 3 | import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; | 3 | import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; |
| 4 | +import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; | ||
| 4 | import com.bsth.data.msg_queue.DirectivePushQueue; | 5 | import com.bsth.data.msg_queue.DirectivePushQueue; |
| 5 | import com.bsth.data.msg_queue.WebSocketPushQueue; | 6 | import com.bsth.data.msg_queue.WebSocketPushQueue; |
| 6 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| @@ -24,6 +25,11 @@ public class ThreadMonotor extends Thread{ | @@ -24,6 +25,11 @@ public class ThreadMonotor extends Thread{ | ||
| 24 | GpsRealAnalyse.shutdown(); | 25 | GpsRealAnalyse.shutdown(); |
| 25 | } | 26 | } |
| 26 | 27 | ||
| 28 | + if(GpsRealAnalyse.isIdle()){ | ||
| 29 | + //尝试使用网关的GPS实时对照数据 | ||
| 30 | + GpsDataLoaderThread.setFlag(-1); | ||
| 31 | + } | ||
| 32 | + | ||
| 27 | //webSocket 消息推送队列 | 33 | //webSocket 消息推送队列 |
| 28 | if(WebSocketPushQueue.isIdle()){ | 34 | if(WebSocketPushQueue.isIdle()){ |
| 29 | log.warn("WebSocketPushQueue isIdle true !!!!"); | 35 | log.warn("WebSocketPushQueue isIdle true !!!!"); |
src/main/java/com/bsth/data/gpsdata/arrival/GpsRealAnalyse.java
| @@ -50,6 +50,10 @@ public class GpsRealAnalyse { | @@ -50,6 +50,10 @@ public class GpsRealAnalyse { | ||
| 50 | return System.currentTimeMillis() - st > 1000 * 20; | 50 | return System.currentTimeMillis() - st > 1000 * 20; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | + public static boolean isIdle(){ | ||
| 54 | + return System.currentTimeMillis() - st > 1000 * 30; | ||
| 55 | + } | ||
| 56 | + | ||
| 53 | public void analyse(List<GpsEntity> list) { | 57 | public void analyse(List<GpsEntity> list) { |
| 54 | try { | 58 | try { |
| 55 | st = System.currentTimeMillis(); | 59 | st = System.currentTimeMillis(); |