diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java index d4a5b1d..b76eeaa 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java @@ -78,7 +78,7 @@ public class MonitorServiceImpl implements MonitorService { 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}") @@ -191,7 +191,6 @@ public class MonitorServiceImpl implements MonitorService { // 数据切割 int limit = countStep(stationRealVos.size()); List> 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); // Map valueMap = new ConcurrentHashMap<>(); // > @@ -223,14 +222,13 @@ public class MonitorServiceImpl implements MonitorService { }); countDownLatch.countDown(); })); - // 等待所有线程执行完成 try { + // 等待所有线程执行完成 countDownLatch.await(); } catch (InterruptedException e) { e.printStackTrace(); Thread.currentThread().interrupt(); } - pool.shutdown(); // redis 存储 redisTemplate.opsForValue().set(real_cache_final,JSONObject.toJSONString(valueMap)); redisTemplate.opsForValue().set(real_gather_cache_final,JSONObject.toJSONString(keyMap));