Commit 7673d3a5f6d5ab07407f952fc16f3da1e1e7f6b4
1 parent
bbf95631
闵行18路测试用部分代码调整
Showing
5 changed files
with
14 additions
and
9 deletions
src/main/java/com/bsth/XDApplication.java
| ... | ... | @@ -127,7 +127,7 @@ public class XDApplication implements CommandLineRunner { |
| 127 | 127 | log.info("devInit..."); |
| 128 | 128 | ScheduledExecutorService sexec = Application.mainServices; |
| 129 | 129 | //抓取GPS数据 |
| 130 | - gpsDataLoader.setFlag(-1); | |
| 130 | + GpsDataLoaderThread.setFlag(-1); | |
| 131 | 131 | //dayOfSchedule.dataRecovery(); |
| 132 | 132 | //sexec.scheduleWithFixedDelay(gpsDataLoader, 60, 4, TimeUnit.SECONDS); |
| 133 | 133 | //实际排班更新线程 |
| ... | ... | @@ -160,8 +160,8 @@ public class XDApplication implements CommandLineRunner { |
| 160 | 160 | |
| 161 | 161 | /** 线调业务 */ |
| 162 | 162 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 |
| 163 | - sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 30, TimeUnit.SECONDS);//检查班次误点 | |
| 164 | - gpsDataLoader.setFlag(-1); | |
| 163 | + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 20, TimeUnit.SECONDS);//检查班次误点 | |
| 164 | + GpsDataLoaderThread.setFlag(-1); | |
| 165 | 165 | sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据 |
| 166 | 166 | sexec.scheduleWithFixedDelay(fixedCheckStationCodeThread, 60, 60 * 5, TimeUnit.SECONDS);//检查班次站点编码 |
| 167 | 167 | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
| ... | ... | @@ -41,7 +41,7 @@ public class DataHandleProcess { |
| 41 | 41 | |
| 42 | 42 | static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class); |
| 43 | 43 | |
| 44 | - final static int POOL_SIZE = 8; | |
| 44 | + final static int POOL_SIZE = 20; | |
| 45 | 45 | |
| 46 | 46 | static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1); |
| 47 | 47 | public static CountDownLatch count; | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/thread/GpsDataLoaderThread.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.data.gpsdata_v2.thread; |
| 3 | 3 | import com.bsth.data.gpsdata_v2.DataHandleProcess; |
| 4 | 4 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 5 | 5 | import com.bsth.data.gpsdata_v2.load.GatewayHttpLoader; |
| 6 | +import com.bsth.data.gpsdata_v2.load.SocketClientLoader; | |
| 6 | 7 | import org.slf4j.Logger; |
| 7 | 8 | import org.slf4j.LoggerFactory; |
| 8 | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -31,13 +32,13 @@ public class GpsDataLoaderThread extends Thread { |
| 31 | 32 | @Override |
| 32 | 33 | public void run() { |
| 33 | 34 | try { |
| 34 | - List<GpsEntity> list = GatewayHttpLoader.load(); | |
| 35 | - /*if (flag == 0) | |
| 35 | + List<GpsEntity> list; | |
| 36 | + if (flag == 0) | |
| 36 | 37 | list = SocketClientLoader.load(); |
| 37 | 38 | else |
| 38 | - list = GatewayHttpLoader.load();*/ | |
| 39 | + list = GatewayHttpLoader.load(); | |
| 39 | 40 | |
| 40 | - if (null != list && list.size() > 0) | |
| 41 | + if(null != list && list.size() > 0) | |
| 41 | 42 | handleProcess.handle(list); |
| 42 | 43 | } catch (Exception e) { |
| 43 | 44 | logger.error("", e); | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/utils/GeoUtils.java
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataRecovery.java
| ... | ... | @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware { |
| 84 | 84 | Calendar calendar = Calendar.getInstance(); |
| 85 | 85 | int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR); |
| 86 | 86 | |
| 87 | - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=39"; //+ dayOfYear; | |
| 87 | + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info"; //+ dayOfYear; | |
| 88 | 88 | JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource()); |
| 89 | 89 | |
| 90 | 90 | List<GpsEntity> list = | ... | ... |