Commit 5af7d9e6 authored by duanruiming's avatar duanruiming

[update] 优化东土实时数据调用

parent ee9bf979
...@@ -11,6 +11,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; ...@@ -11,6 +11,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -23,10 +24,11 @@ public class RealTimeTask { ...@@ -23,10 +24,11 @@ public class RealTimeTask {
@Resource(name = "commonThreadPoolExecutor") @Resource(name = "commonThreadPoolExecutor")
ThreadPoolTaskExecutor commonThreadPoolExecutor; ThreadPoolTaskExecutor commonThreadPoolExecutor;
@Scheduled(initialDelay = 60 * 1000, fixedRate = 60 * 1000) @Scheduled(initialDelay = 60 * 1000, fixedRate = 1000)
public void getRealTimeLightStatus() throws Exception { public void getRealTimeLightStatus() throws Exception {
Map<String, CrossInfoPO> crossInfoCache = CrossInfoCache.getCrossInfoCache(); Map<String, CrossInfoPO> crossInfoCache = CrossInfoCache.getCrossInfoCache();
if (!crossInfoCache.isEmpty()) { if (!crossInfoCache.isEmpty()) {
System.err.println(new Date());
for (Map.Entry<String, CrossInfoPO> entry : crossInfoCache.entrySet()) { for (Map.Entry<String, CrossInfoPO> entry : crossInfoCache.entrySet()) {
String crossId = entry.getKey(); String crossId = entry.getKey();
commonThreadPoolExecutor.execute(() -> { commonThreadPoolExecutor.execute(() -> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment