Jay
2024-11-25 ee9f604388a3e77d3f4654e326f3976552e7f532
提交 | 用户 | 时间
a6de49 1 package com.iailab.module.data.job.task;
H 2
3 import com.iailab.module.data.point.collection.PointCollector;
4 import org.slf4j.Logger;
5 import org.slf4j.LoggerFactory;
6 import javax.annotation.Resource;
7 import org.springframework.stereotype.Component;
8
9 import java.time.LocalDateTime;
10 import java.util.Calendar;
11
12 /**
13  * Point采集器KIO 1min
14  * 0 0/1 * * * ?
15  *
16  * @author PanZhibao
17  * @Description
18  * @createTime 2024年06月14日
19  */
20 @Component("pointCollectTaskNetKIO60")
21 public class PointCollectTaskNetKIO60 implements ITask {
22     private Logger logger = LoggerFactory.getLogger(getClass());
23
24     private final String NET = "NET_KIO60";
25
26     @Resource
27     private PointCollector pointCollector;
28
29     @Override
30     public void run(String params){
31         // 0/10 * * * * ?
32         logger.debug("PointCollectTaskNetKIO60定时任务正在执行,参数为:{}", params);
33         try {
34             Calendar calendar = Calendar.getInstance();
35             calendar.set(Calendar.MILLISECOND, 0);
36             pointCollector.collect(calendar.getTime(), NET);
37             logger.info("PointCollectTaskNetKIO60定时任务完成时间:" + LocalDateTime.now());
38         } catch (Exception ex) {
39             ex.printStackTrace();
40             logger.error("PointCollectTaskNetKIO60定时任务失败时间:" + LocalDateTime.now());
41         }
42
43     }
44 }