From e5892e164d469acf687c1cb3e598c6c44f9ef1c1 Mon Sep 17 00:00:00 2001 From: Willem Jiang Date: Tue, 27 Dec 2016 13:33:43 +0800 Subject: [PATCH] [ROCKETMQ-9] Clean up the code --- .../java/com/alibaba/rocketmq/store/MappedFileQueue.java | 6 +++--- .../java/com/alibaba/rocketmq/store/index/IndexService.java | 4 ++-- rocketmq-store/src/test/resources/logback-test.xml | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/MappedFileQueue.java b/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/MappedFileQueue.java index 8d9d3ab0..0d15ece1 100644 --- a/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/MappedFileQueue.java +++ b/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/MappedFileQueue.java @@ -484,10 +484,10 @@ public class MappedFileQueue { try { return this.mappedFiles.get(index); } catch (Exception e) { - if (returnFirstOnNotFound) + if (returnFirstOnNotFound) { return mappedFile; - - LOG_ERROR.warn("findMappedFileByOffset failure. {}", UtilAll.currentStackTrace()); + } + LOG_ERROR.warn("findMappedFileByOffset failure. ", e); } } } catch (Exception e) { diff --git a/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/index/IndexService.java b/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/index/IndexService.java index fded7473..f4f27bc3 100644 --- a/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/index/IndexService.java +++ b/rocketmq-store/src/main/java/com/alibaba/rocketmq/store/index/IndexService.java @@ -279,7 +279,7 @@ public class IndexService { * * @return {@link IndexFile} or null on failure. */ - private IndexFile retryGetAndCreateIndexFile() { + public IndexFile retryGetAndCreateIndexFile() { IndexFile indexFile = null; for (int times = 0; null == indexFile && times < MAX_TRY_IDX_CREATE; times++) { @@ -288,7 +288,7 @@ public class IndexService { break; try { - log.error("Tried to create index file " + times + " times"); + log.info("Tried to create index file " + times + " times"); Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); diff --git a/rocketmq-store/src/test/resources/logback-test.xml b/rocketmq-store/src/test/resources/logback-test.xml index 11d429df..6754c0aa 100644 --- a/rocketmq-store/src/test/resources/logback-test.xml +++ b/rocketmq-store/src/test/resources/logback-test.xml @@ -20,6 +20,7 @@ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n + UTF-8 -- GitLab