Showing
3 changed files
with
11 additions
and
0 deletions
1 | package com.ui.cloud.task; | 1 | package com.ui.cloud.task; |
2 | 2 | ||
3 | import com.ui.model.BaseResponse; | 3 | import com.ui.model.BaseResponse; |
4 | +import org.apache.commons.lang.StringUtils; | ||
4 | import org.slf4j.Logger; | 5 | import org.slf4j.Logger; |
5 | import org.slf4j.LoggerFactory; | 6 | import org.slf4j.LoggerFactory; |
6 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
8 | +import org.springframework.beans.factory.annotation.Value; | ||
7 | import org.springframework.scheduling.annotation.EnableScheduling; | 9 | import org.springframework.scheduling.annotation.EnableScheduling; |
8 | import org.springframework.scheduling.annotation.Scheduled; | 10 | import org.springframework.scheduling.annotation.Scheduled; |
9 | import org.springframework.stereotype.Component; | 11 | import org.springframework.stereotype.Component; |
@@ -17,6 +19,10 @@ import org.springframework.stereotype.Component; | @@ -17,6 +19,10 @@ import org.springframework.stereotype.Component; | ||
17 | public class FetchAutoScalingTask { | 19 | public class FetchAutoScalingTask { |
18 | private Logger logger = LoggerFactory.getLogger(getClass()); | 20 | private Logger logger = LoggerFactory.getLogger(getClass()); |
19 | 21 | ||
22 | + //当前环境 | ||
23 | + @Value("${system.envi}") | ||
24 | + private String env; | ||
25 | + | ||
20 | @Autowired | 26 | @Autowired |
21 | private AutoScalingLoader autoScalingLoader; | 27 | private AutoScalingLoader autoScalingLoader; |
22 | 28 | ||
@@ -40,6 +46,9 @@ public class FetchAutoScalingTask { | @@ -40,6 +46,9 @@ public class FetchAutoScalingTask { | ||
40 | */ | 46 | */ |
41 | @Scheduled(cron = "15/30 * * * * ?") | 47 | @Scheduled(cron = "15/30 * * * * ?") |
42 | public void qcloudFetchAutoScaling() { | 48 | public void qcloudFetchAutoScaling() { |
49 | + if(StringUtils.equals("test",env)){ | ||
50 | + return ; | ||
51 | + } | ||
43 | BaseResponse groups=autoScalingLoader.remoteLoadAutoScalingGroup(2); | 52 | BaseResponse groups=autoScalingLoader.remoteLoadAutoScalingGroup(2); |
44 | if(groups==null){ | 53 | if(groups==null){ |
45 | logger.error("FetchAutoScalingTask qcloudFetchAutoScaling result is null"); | 54 | logger.error("FetchAutoScalingTask qcloudFetchAutoScaling result is null"); |
-
Please register or login to post a comment