提交 3292d039 编写于 作者: Y yukon 提交者: dongeforever

[ROCKETMQ-206] Catch the IOException when call the file2String method.

上级 f115b528
......@@ -180,7 +180,12 @@ public class LocalFileOffsetStore implements OffsetStore {
}
private OffsetSerializeWrapper readLocalOffset() throws MQClientException {
String content = MixAll.file2String(this.storePath);
String content = null;
try {
content = MixAll.file2String(this.storePath);
} catch (IOException e) {
log.warn("Load local offset store file exception", e);
}
if (null == content || content.length() == 0) {
return this.readLocalOffsetBak();
} else {
......@@ -198,7 +203,12 @@ public class LocalFileOffsetStore implements OffsetStore {
}
private OffsetSerializeWrapper readLocalOffsetBak() throws MQClientException {
String content = MixAll.file2String(this.storePath + ".bak");
String content = null;
try {
content = MixAll.file2String(this.storePath + ".bak");
} catch (IOException e) {
log.warn("Load local offset store bak file exception", e);
}
if (content != null && content.length() > 0) {
OffsetSerializeWrapper offsetSerializeWrapper = null;
try {
......
......@@ -17,6 +17,7 @@
package org.apache.rocketmq.example.benchmark;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Timer;
......@@ -39,7 +40,7 @@ import org.apache.rocketmq.srvutil.ServerUtil;
public class Consumer {
public static void main(String[] args) throws MQClientException {
public static void main(String[] args) throws MQClientException, IOException {
Options options = ServerUtil.buildCommandlineOptions(new Options());
CommandLine commandLine = ServerUtil.parseCmdLine("benchmarkConsumer", args, buildCommandlineOptions(options), new PosixParser());
if (null == commandLine) {
......
......@@ -17,6 +17,7 @@
package org.apache.rocketmq.example.filter;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
......@@ -28,7 +29,7 @@ import org.apache.rocketmq.common.message.MessageExt;
public class Consumer {
public static void main(String[] args) throws InterruptedException, MQClientException {
public static void main(String[] args) throws InterruptedException, MQClientException, IOException {
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("ConsumerGroupNamecc4");
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
......
......@@ -43,7 +43,12 @@ public class KVConfigManager {
}
public void load() {
String content = MixAll.file2String(this.namesrvController.getNamesrvConfig().getKvConfigPath());
String content = null;
try {
content = MixAll.file2String(this.namesrvController.getNamesrvConfig().getKvConfigPath());
} catch (IOException e) {
log.warn("Load KV config table exception", e);
}
if (content != null) {
KVConfigSerializeWrapper kvConfigSerializeWrapper =
KVConfigSerializeWrapper.fromJson(content, KVConfigSerializeWrapper.class);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册