Authored by jack

fix memcache update time

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