Commit f4e41659d8ea91db1c3ec5a584270a7b3ef8ce65
1 parent
c6adfd24
修复国标级联注册和心跳重复发送的问题
Showing
1 changed file
with
3 additions
and
1 deletions
src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java
| @@ -9,6 +9,7 @@ import org.springframework.stereotype.Component; | @@ -9,6 +9,7 @@ import org.springframework.stereotype.Component; | ||
| 9 | 9 | ||
| 10 | import javax.annotation.PostConstruct; | 10 | import javax.annotation.PostConstruct; |
| 11 | import java.time.Instant; | 11 | import java.time.Instant; |
| 12 | +import java.util.Date; | ||
| 12 | import java.util.Map; | 13 | import java.util.Map; |
| 13 | import java.util.Set; | 14 | import java.util.Set; |
| 14 | import java.util.concurrent.ConcurrentHashMap; | 15 | import java.util.concurrent.ConcurrentHashMap; |
| @@ -59,7 +60,8 @@ public class DynamicTask { | @@ -59,7 +60,8 @@ public class DynamicTask { | ||
| 59 | } | 60 | } |
| 60 | } | 61 | } |
| 61 | // scheduleWithFixedDelay 必须等待上一个任务结束才开始计时period, cycleForCatalog表示执行的间隔 | 62 | // scheduleWithFixedDelay 必须等待上一个任务结束才开始计时period, cycleForCatalog表示执行的间隔 |
| 62 | - future = threadPoolTaskScheduler.scheduleAtFixedRate(task, cycleForCatalog); | 63 | + |
| 64 | + future = threadPoolTaskScheduler.scheduleAtFixedRate(task, new Date(System.currentTimeMillis() + cycleForCatalog), cycleForCatalog); | ||
| 63 | if (future != null){ | 65 | if (future != null){ |
| 64 | futureMap.put(key, future); | 66 | futureMap.put(key, future); |
| 65 | runnableMap.put(key, task); | 67 | runnableMap.put(key, task); |