...
|
...
|
@@ -3,7 +3,10 @@ package com.monitor.middleware.redis.task; |
|
|
|
|
|
import com.monitor.middleware.redis.constants.Constants;
|
|
|
import com.monitor.middleware.redis.model.RedisInfo;
|
|
|
import com.sun.org.apache.xml.internal.resolver.helpers.Debug;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import redis.clients.jedis.Jedis;
|
|
|
|
|
|
import java.text.DecimalFormat;
|
...
|
...
|
@@ -15,6 +18,8 @@ import java.util.Map; |
|
|
*/
|
|
|
public class RedisTask extends Task {
|
|
|
|
|
|
public static final Logger DEBUG = LoggerFactory.getLogger(RedisTask.class);
|
|
|
|
|
|
private Long requests = 0L;
|
|
|
|
|
|
public RedisTask(String url, Long requests) {
|
...
|
...
|
@@ -27,6 +32,10 @@ public class RedisTask extends Task { |
|
|
|
|
|
@Override
|
|
|
public void doTask() {
|
|
|
|
|
|
DEBUG.info("Start to do redis {} task ", this.getIp() + ":" + this.getPort());
|
|
|
|
|
|
try {
|
|
|
Jedis client = new Jedis(this.getIp(), this.getPort(), 2 * 1000);
|
|
|
|
|
|
String info = client.info();
|
...
|
...
|
@@ -52,6 +61,10 @@ public class RedisTask extends Task { |
|
|
|
|
|
//save
|
|
|
Constants.REDIS_INFO_MAP.put(this.getUrl(), redisInfo);
|
|
|
} catch (Exception e) {
|
|
|
DEBUG.error("Failed to do redis {} task ,error {} ", this.getIp() + ":" + this.getPort(), e);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
|