Authored by jack

增加异常捕获

package com.monitor.middleware.redis.task;
import lombok.Getter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.concurrent.Callable;
... ... @@ -9,6 +11,7 @@ import java.util.concurrent.Callable;
* Created by yoho on 2016/9/21.
*/
public class Task implements Callable {
public static final Logger DEBUG = LoggerFactory.getLogger(Task.class);
@Getter
private String url;
... ... @@ -20,7 +23,7 @@ public class Task implements Callable {
private int port;
public Task(String url) {
this.url=url;
this.url = url;
String[] urls = url.split(":", 2);
... ... @@ -35,8 +38,13 @@ public class Task implements Callable {
@Override
public Object call() throws Exception {
try {
doTask();
} catch (Exception e) {
DEBUG.error("Failed to execute task ... error {}", e);
e.printStackTrace();
}
doTask();
return null;
}
... ...
... ... @@ -45,6 +45,7 @@ public class TwemproxyTask extends Task {
@Override
public void doTask() {
String info = TelnetUtils.getResult(this.getIp(), this.monitPort);
TwemproxyInfo twemproxyInfo = new TwemproxyInfo(this.getIp(), this.getPort(), info);
... ...