定时任务时间间隔改成cron表达式 测试resource中cron表达式为不执行状态 可修改
Showing
8 changed files
with
37 additions
and
9 deletions
@@ -27,7 +27,7 @@ public class NginxCalTask { | @@ -27,7 +27,7 @@ public class NginxCalTask { | ||
27 | @Autowired | 27 | @Autowired |
28 | public AlarmMsgComp alarmMsgComp; | 28 | public AlarmMsgComp alarmMsgComp; |
29 | 29 | ||
30 | - @Scheduled(fixedRate = 2 * 60 * 1000L) | 30 | + @Scheduled(cron = "${cron_task_nginx_cal}") |
31 | public void call() { | 31 | public void call() { |
32 | 32 | ||
33 | try { | 33 | try { |
@@ -29,7 +29,7 @@ public class NginxScanTask { | @@ -29,7 +29,7 @@ public class NginxScanTask { | ||
29 | ITypeInfoService typeService; | 29 | ITypeInfoService typeService; |
30 | 30 | ||
31 | //自动发现Nginx监控对象 | 31 | //自动发现Nginx监控对象 |
32 | - @Scheduled(fixedRate = 60*1000L) | 32 | + @Scheduled(cron = "${cron_task_nginx_scan}") |
33 | public void doTask() { | 33 | public void doTask() { |
34 | 34 | ||
35 | List<TypeInfo> typeInfosList = typeService.queryAllTypesInfo(); | 35 | List<TypeInfo> typeInfosList = typeService.queryAllTypesInfo(); |
@@ -51,7 +51,7 @@ public class RabbitMonitTask { | @@ -51,7 +51,7 @@ public class RabbitMonitTask { | ||
51 | @Autowired | 51 | @Autowired |
52 | AlarmMsgComp alarmMsgComp; | 52 | AlarmMsgComp alarmMsgComp; |
53 | 53 | ||
54 | - @Scheduled(fixedRate = 2 * 60 * 1000L) | 54 | + @Scheduled(cron = "${cron_task_rabbit_monit}") |
55 | public void doTask() { | 55 | public void doTask() { |
56 | synchronized (InterVar.LOCK.intern()) { | 56 | synchronized (InterVar.LOCK.intern()) { |
57 | for (Map.Entry<Integer, MObjectInfo> entry : InterVar.moMaps.entrySet()) { | 57 | for (Map.Entry<Integer, MObjectInfo> entry : InterVar.moMaps.entrySet()) { |
@@ -41,7 +41,7 @@ public class RabbitScanTask implements Runnable { | @@ -41,7 +41,7 @@ public class RabbitScanTask implements Runnable { | ||
41 | } | 41 | } |
42 | 42 | ||
43 | //自动发现rabbit监控对象 | 43 | //自动发现rabbit监控对象 |
44 | - @Scheduled(fixedRate = 60 * 1000L) | 44 | + @Scheduled(cron = "${cron_task_rabbit_scan}") |
45 | public void doTask() { | 45 | public void doTask() { |
46 | 46 | ||
47 | List<TypeInfo> typeInfosList = typeService.queryAllTypesInfo(); | 47 | List<TypeInfo> typeInfosList = typeService.queryAllTypesInfo(); |
@@ -11,9 +11,8 @@ public class RedisMonitorTask { | @@ -11,9 +11,8 @@ public class RedisMonitorTask { | ||
11 | 11 | ||
12 | @Autowired | 12 | @Autowired |
13 | private IRedisMonitorHandleService redisMonitorService; | 13 | private IRedisMonitorHandleService redisMonitorService; |
14 | - | ||
15 | - //@Scheduled(fixedRate=20000) | ||
16 | - @Scheduled(cron="0 0/3 * * * ? ") | 14 | + |
15 | + @Scheduled(cron="${cron_task_redis_monitor}") | ||
17 | public void redisMonitor(){ | 16 | public void redisMonitor(){ |
18 | redisMonitorService.redisMonitor(); | 17 | redisMonitorService.redisMonitor(); |
19 | } | 18 | } |
@@ -18,8 +18,7 @@ public class ZookeeperMonitorTask { | @@ -18,8 +18,7 @@ public class ZookeeperMonitorTask { | ||
18 | @Autowired | 18 | @Autowired |
19 | IZkMonitorHandleService zkMonitorService; | 19 | IZkMonitorHandleService zkMonitorService; |
20 | 20 | ||
21 | - //@Scheduled(fixedRate=20000) | ||
22 | - @Scheduled(cron="0 0/2 * * * ? ") | 21 | + @Scheduled(cron="${cron_task_zookeeper_monitor}") |
23 | public void zookeeperMonitor() { | 22 | public void zookeeperMonitor() { |
24 | zkMonitorService.zookeeperMonitor(); | 23 | zkMonitorService.zookeeperMonitor(); |
25 | } | 24 | } |
1 | +#cron_task_zookeeper_monitor=0 0/2 * * * ? | ||
2 | +cron_task_zookeeper_monitor=0 0 0 * * ? | ||
3 | + | ||
4 | +#cron_task_redis_monitor=0 0/3 * * * ? | ||
5 | +cron_task_redis_monitor=0 0 0 * * ? | ||
6 | + | ||
7 | +#cron_task_nginx_scan=0 0/1 * * * ? | ||
8 | +cron_task_nginx_scan=0 0 0 * * ? | ||
9 | + | ||
10 | +#cron_task_nginx_cal=0 0/2 * * * ? | ||
11 | +corn_task_nginx_cal=0 0 0 * * ? | ||
12 | + | ||
13 | +#cron_task_rabbit_monit=0 0/2 * * * ? | ||
14 | +cron_task_rabbit_monit=0 0 0 * * ? | ||
15 | + | ||
16 | +#cron_task_rabbit_scan=0 0/1 * * * ? | ||
17 | +cron_task_rabbit_scan=0 0 0 * * ? |
-
Please register or login to post a comment