You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
585 B
Java

2 years ago
package com.xydl.Schedule;
import com.xydl.service.impl.MqttServiceImpl;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
public class MyTimerTask {
public static void main(String[] args) {
new Timer().schedule(new TimerTask() {
@Override
public void run() {
System.out.println("运行定时任务: "+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
new MqttServiceImpl().reportRecord();
}
}, 1000, 3000);
}
}