|
@@ -6,6 +6,8 @@ import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
import org.apache.logging.log4j.Logger;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
|
+import org.springframework.scheduling.annotation.EnableAsync;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
|
@@ -16,6 +18,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|
**/
|
|
**/
|
|
@Configuration
|
|
@Configuration
|
|
@EnableScheduling
|
|
@EnableScheduling
|
|
|
|
+@EnableAsync
|
|
public class MqttHeartbeatSchedule {
|
|
public class MqttHeartbeatSchedule {
|
|
private static final Logger logger = LogManager.getLogger(MqttHeartbeatSchedule.class);
|
|
private static final Logger logger = LogManager.getLogger(MqttHeartbeatSchedule.class);
|
|
@Autowired
|
|
@Autowired
|
|
@@ -23,6 +26,7 @@ public class MqttHeartbeatSchedule {
|
|
/**
|
|
/**
|
|
* 5 分钟调用一次
|
|
* 5 分钟调用一次
|
|
*/
|
|
*/
|
|
|
|
+ @Async
|
|
@Scheduled(cron = "0 0/5 * * * ?")
|
|
@Scheduled(cron = "0 0/5 * * * ?")
|
|
public void rotationDev() {
|
|
public void rotationDev() {
|
|
try {
|
|
try {
|