Showing
2 changed files
with
13 additions
and
0 deletions
@@ -3,7 +3,10 @@ package com.monitor.middleware.redis.task; | @@ -3,7 +3,10 @@ package com.monitor.middleware.redis.task; | ||
3 | 3 | ||
4 | import com.monitor.middleware.redis.constants.Constants; | 4 | import com.monitor.middleware.redis.constants.Constants; |
5 | import com.monitor.middleware.redis.model.RedisInfo; | 5 | import com.monitor.middleware.redis.model.RedisInfo; |
6 | +import com.sun.org.apache.xml.internal.resolver.helpers.Debug; | ||
6 | import org.apache.commons.lang.StringUtils; | 7 | import org.apache.commons.lang.StringUtils; |
8 | +import org.slf4j.Logger; | ||
9 | +import org.slf4j.LoggerFactory; | ||
7 | import redis.clients.jedis.Jedis; | 10 | import redis.clients.jedis.Jedis; |
8 | 11 | ||
9 | import java.text.DecimalFormat; | 12 | import java.text.DecimalFormat; |
@@ -15,6 +18,8 @@ import java.util.Map; | @@ -15,6 +18,8 @@ import java.util.Map; | ||
15 | */ | 18 | */ |
16 | public class RedisTask extends Task { | 19 | public class RedisTask extends Task { |
17 | 20 | ||
21 | + public static final Logger DEBUG = LoggerFactory.getLogger(RedisTask.class); | ||
22 | + | ||
18 | private Long requests = 0L; | 23 | private Long requests = 0L; |
19 | 24 | ||
20 | public RedisTask(String url, Long requests) { | 25 | public RedisTask(String url, Long requests) { |
@@ -27,6 +32,10 @@ public class RedisTask extends Task { | @@ -27,6 +32,10 @@ public class RedisTask extends Task { | ||
27 | 32 | ||
28 | @Override | 33 | @Override |
29 | public void doTask() { | 34 | public void doTask() { |
35 | + | ||
36 | + DEBUG.info("Start to do redis {} task ", this.getIp() + ":" + this.getPort()); | ||
37 | + | ||
38 | + try { | ||
30 | Jedis client = new Jedis(this.getIp(), this.getPort(), 2 * 1000); | 39 | Jedis client = new Jedis(this.getIp(), this.getPort(), 2 * 1000); |
31 | 40 | ||
32 | String info = client.info(); | 41 | String info = client.info(); |
@@ -52,6 +61,10 @@ public class RedisTask extends Task { | @@ -52,6 +61,10 @@ public class RedisTask extends Task { | ||
52 | 61 | ||
53 | //save | 62 | //save |
54 | Constants.REDIS_INFO_MAP.put(this.getUrl(), redisInfo); | 63 | Constants.REDIS_INFO_MAP.put(this.getUrl(), redisInfo); |
64 | + } catch (Exception e) { | ||
65 | + DEBUG.error("Failed to do redis {} task ,error {} ", this.getIp() + ":" + this.getPort(), e); | ||
66 | + } | ||
67 | + | ||
55 | } | 68 | } |
56 | 69 | ||
57 | 70 |
-
Please register or login to post a comment