Authored by jack

fix memcache update time

@@ -5,6 +5,7 @@ import com.monitor.cmdb.service.ITypeInfoService; @@ -5,6 +5,7 @@ import com.monitor.cmdb.service.ITypeInfoService;
5 import com.monitor.middleware.memcached.constant.MemConstants; 5 import com.monitor.middleware.memcached.constant.MemConstants;
6 import com.monitor.middleware.memcached.model.MemcacheView; 6 import com.monitor.middleware.memcached.model.MemcacheView;
7 7
  8 +import com.monitor.middleware.memcached.service.MemcachedMonitService;
8 import com.monitor.model.response.BaseResponse; 9 import com.monitor.model.response.BaseResponse;
9 10
10 import org.slf4j.Logger; 11 import org.slf4j.Logger;
@@ -33,14 +34,14 @@ public class MemcachedCtrl { @@ -33,14 +34,14 @@ public class MemcachedCtrl {
33 private static final String QCLOUD_JAVA_L2 = "qcloud_java_l2"; 34 private static final String QCLOUD_JAVA_L2 = "qcloud_java_l2";
34 35
35 @Autowired 36 @Autowired
36 - private ITypeInfoService typeService;  
37 -  
38 - @Autowired  
39 IMObjectInfoService imObjectInfoService; 37 IMObjectInfoService imObjectInfoService;
40 38
41 @Autowired 39 @Autowired
42 ITypeInfoService iTypeInfoService; 40 ITypeInfoService iTypeInfoService;
43 41
  42 + @Autowired
  43 + MemcachedMonitService memcachedMonitService;
  44 +
44 /* @RequestMapping(value = "/allMemcached") 45 /* @RequestMapping(value = "/allMemcached")
45 public BaseResponse queryAllMemcached() { 46 public BaseResponse queryAllMemcached() {
46 BaseResponse response = new BaseResponse(); 47 BaseResponse response = new BaseResponse();
@@ -175,7 +176,11 @@ public class MemcachedCtrl { @@ -175,7 +176,11 @@ public class MemcachedCtrl {
175 176
176 @RequestMapping(value = "/updateTime") 177 @RequestMapping(value = "/updateTime")
177 public String queryUpdateTime() { 178 public String queryUpdateTime() {
178 - return MemConstants.MEMCACHED_UPDATE_TIME.get("memcachedUpdateTime"); 179 + Date date = new Date(memcachedMonitService.getUpdateTime());
  180 +
  181 + String update = (new java.text.SimpleDateFormat("yyyy-MM-dd hh:mm:ss")).format(date);
  182 +
  183 + return update;
179 } 184 }
180 185
181 186
@@ -6,6 +6,7 @@ import com.monitor.cmdb.service.ITypeInfoService; @@ -6,6 +6,7 @@ import com.monitor.cmdb.service.ITypeInfoService;
6 import com.monitor.common.util.SpringContextUtils; 6 import com.monitor.common.util.SpringContextUtils;
7 import com.monitor.middleware.memcached.task.MemcachedTask; 7 import com.monitor.middleware.memcached.task.MemcachedTask;
8 import com.monitor.middleware.redis.service.impl.RedisMonitService; 8 import com.monitor.middleware.redis.service.impl.RedisMonitService;
  9 +import lombok.Getter;
9 import org.slf4j.Logger; 10 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory; 11 import org.slf4j.LoggerFactory;
11 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
@@ -30,9 +31,14 @@ public class MemcachedMonitService { @@ -30,9 +31,14 @@ public class MemcachedMonitService {
30 @Autowired 31 @Autowired
31 private ITypeInfoService typeInfoService; 32 private ITypeInfoService typeInfoService;
32 33
  34 + @Getter
  35 + private long updateTime;
  36 +
33 @Scheduled(cron = "${cron_task_memcached}") 37 @Scheduled(cron = "${cron_task_memcached}")
34 public void doMonitTask() { 38 public void doMonitTask() {
35 39
  40 + updateTime=System.currentTimeMillis();
  41 +
36 //查询逻辑分组 memcached 42 //查询逻辑分组 memcached
37 Map<String, List<MObjectInfo>> memcachedMap = queryAllMoListByLogic("memcached"); 43 Map<String, List<MObjectInfo>> memcachedMap = queryAllMoListByLogic("memcached");
38 44