|
|
@ -78,7 +78,7 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
|
|
|
|
|
|
|
|
private final IAnalyseDataSearchClient analyseDataSearchClient; |
|
|
|
private final IAnalyseDataSearchClient analyseDataSearchClient; |
|
|
|
|
|
|
|
|
|
|
|
private static final ExecutorService pool = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); |
|
|
|
private static final ExecutorService pool = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), new ThreadFactoryBuilder().setNameFormat("load-monitoring-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${hzims.equipment.emInfo.emInfoList}") |
|
|
|
@Value("${hzims.equipment.emInfo.emInfoList}") |
|
|
@ -191,7 +191,6 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
// 数据切割
|
|
|
|
// 数据切割
|
|
|
|
int limit = countStep(stationRealVos.size()); |
|
|
|
int limit = countStep(stationRealVos.size()); |
|
|
|
List<List<StationRealVo>> list = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stationRealVos.stream().skip((long) a * 5).limit(5).parallel().collect(Collectors.toList())).collect(Collectors.toList()); |
|
|
|
List<List<StationRealVo>> list = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stationRealVos.stream().skip((long) a * 5).limit(5).parallel().collect(Collectors.toList())).collect(Collectors.toList()); |
|
|
|
ExecutorService pool = Executors.newFixedThreadPool(limit); |
|
|
|
|
|
|
|
// <real,value>
|
|
|
|
// <real,value>
|
|
|
|
Map<String,String> valueMap = new ConcurrentHashMap<>(); |
|
|
|
Map<String,String> valueMap = new ConcurrentHashMap<>(); |
|
|
|
// <real,<attribute,value>>
|
|
|
|
// <real,<attribute,value>>
|
|
|
@ -223,14 +222,13 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
}); |
|
|
|
}); |
|
|
|
countDownLatch.countDown(); |
|
|
|
countDownLatch.countDown(); |
|
|
|
})); |
|
|
|
})); |
|
|
|
// 等待所有线程执行完成
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
// 等待所有线程执行完成
|
|
|
|
countDownLatch.await(); |
|
|
|
countDownLatch.await(); |
|
|
|
} catch (InterruptedException e) { |
|
|
|
} catch (InterruptedException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
e.printStackTrace(); |
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
} |
|
|
|
} |
|
|
|
pool.shutdown(); |
|
|
|
|
|
|
|
// redis 存储
|
|
|
|
// redis 存储
|
|
|
|
redisTemplate.opsForValue().set(real_cache_final,JSONObject.toJSONString(valueMap)); |
|
|
|
redisTemplate.opsForValue().set(real_cache_final,JSONObject.toJSONString(valueMap)); |
|
|
|
redisTemplate.opsForValue().set(real_gather_cache_final,JSONObject.toJSONString(keyMap)); |
|
|
|
redisTemplate.opsForValue().set(real_gather_cache_final,JSONObject.toJSONString(keyMap)); |
|
|
|