Skip to content

Commit 2f89371

Browse files
authored
[ISSUE #9620] placeholder replacement string concatenation (#9621)
1 parent 632dc32 commit 2f89371

1 file changed

Lines changed: 29 additions & 29 deletions

File tree

store/src/main/java/org/apache/rocketmq/store/CommitLog.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public boolean load() {
170170
scanFileAndSetReadMode(LibC.MADV_RANDOM);
171171
}
172172
this.mappedFileQueue.checkSelf();
173-
log.info("load commit log " + (result ? "OK" : "Failed"));
173+
log.info("load commit log {}", result ? "OK" : "Failed");
174174
return result;
175175
}
176176

@@ -362,22 +362,22 @@ else if (dispatchRequest.isSuccess() && size == 0) {
362362
index++;
363363
if (index >= mappedFiles.size()) {
364364
// Current branch can not happen
365-
log.info("recover last 3 physics file over, last mapped file " + mappedFile.getFileName());
365+
log.info("recover last 3 physics file over, last mapped file {}", mappedFile.getFileName());
366366
break;
367367
} else {
368368
mappedFile = mappedFiles.get(index);
369369
byteBuffer = mappedFile.sliceByteBuffer();
370370
processOffset = mappedFile.getFileFromOffset();
371371
mappedFileOffset = 0;
372-
log.info("recover next physics file, " + mappedFile.getFileName());
372+
log.info("recover next physics file, {}", mappedFile.getFileName());
373373
}
374374
}
375375
// Intermediate file read error
376376
else if (!dispatchRequest.isSuccess()) {
377377
if (size > 0) {
378378
log.warn("found a half message at {}, it will be truncated.", processOffset + mappedFileOffset);
379379
}
380-
log.info("recover physics file end, " + mappedFile.getFileName());
380+
log.info("recover physics file end, {}", mappedFile.getFileName());
381381
break;
382382
}
383383
}
@@ -448,7 +448,7 @@ public DispatchRequest checkMessageAndReturnSize(java.nio.ByteBuffer byteBuffer,
448448
case BLANK_MAGIC_CODE:
449449
return new DispatchRequest(0, true /* success */);
450450
default:
451-
log.warn("found a illegal magic code 0x" + Integer.toHexString(magicCode));
451+
log.warn("found a illegal magic code 0x{}", Integer.toHexString(magicCode));
452452
return new DispatchRequest(-1, false /* success */);
453453
}
454454

@@ -716,7 +716,7 @@ public void recoverAbnormally(long maxPhyOffsetOfConsumeQueue) throws RocksDBExc
716716
for (; index >= 0; index--) {
717717
mappedFile = mappedFiles.get(index);
718718
if (this.isMappedFileMatchedRecover(mappedFile, false)) {
719-
log.info("recover from this mapped file " + mappedFile.getFileName());
719+
log.info("recover from this mapped file {}", mappedFile.getFileName());
720720
break;
721721
}
722722
}
@@ -761,14 +761,14 @@ else if (size == 0) {
761761
if (index >= mappedFiles.size()) {
762762
// The current branch under normal circumstances should
763763
// not happen
764-
log.info("recover physics file over, last mapped file " + mappedFile.getFileName());
764+
log.info("recover physics file over, last mapped file {}", mappedFile.getFileName());
765765
break;
766766
} else {
767767
mappedFile = mappedFiles.get(index);
768768
byteBuffer = mappedFile.sliceByteBuffer();
769769
processOffset = mappedFile.getFileFromOffset();
770770
mappedFileOffset = 0;
771-
log.info("recover next physics file, " + mappedFile.getFileName());
771+
log.info("recover next physics file, {}", mappedFile.getFileName());
772772
}
773773
}
774774
} else {
@@ -777,7 +777,7 @@ else if (size == 0) {
777777
log.warn("found a half message at {}, it will be truncated.", processOffset + mappedFileOffset);
778778
}
779779

780-
log.info("recover physics file end, " + mappedFile.getFileName() + " pos=" + byteBuffer.position());
780+
log.info("recover physics file end, {} pos={}", mappedFile.getFileName(), byteBuffer.position());
781781
break;
782782
}
783783
}
@@ -1004,7 +1004,7 @@ public CompletableFuture<PutMessageResult> asyncPutMessage(final MessageExtBroke
10041004
}
10051005
}
10061006
if (null == mappedFile) {
1007-
log.error("create mapped file1 error, topic: " + msg.getTopic() + " clientAddr: " + msg.getBornHostString());
1007+
log.error("create mapped file1 error, topic: {} clientAddr: {}", msg.getTopic(), msg.getBornHostString());
10081008
beginTimeInLock = 0;
10091009
return CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.CREATE_MAPPED_FILE_FAILED, null));
10101010
}
@@ -1021,7 +1021,7 @@ public CompletableFuture<PutMessageResult> asyncPutMessage(final MessageExtBroke
10211021
mappedFile = this.mappedFileQueue.getLastMappedFile(0);
10221022
if (null == mappedFile) {
10231023
// XXX: warn and notify me
1024-
log.error("create mapped file2 error, topic: " + msg.getTopic() + " clientAddr: " + msg.getBornHostString());
1024+
log.error("create mapped file2 error, topic: {} clientAddr: {}", msg.getTopic(), msg.getBornHostString());
10251025
beginTimeInLock = 0;
10261026
return CompletableFuture.completedFuture(new PutMessageResult(PutMessageStatus.CREATE_MAPPED_FILE_FAILED, result));
10271027
}
@@ -1371,7 +1371,7 @@ public boolean appendData(long startOffset, byte[] data, int dataStart, int data
13711371
try {
13721372
MappedFile mappedFile = this.mappedFileQueue.getLastMappedFile(startOffset);
13731373
if (null == mappedFile) {
1374-
log.error("appendData getLastMappedFile error " + startOffset);
1374+
log.error("appendData getLastMappedFile error {}", startOffset);
13751375
return false;
13761376
}
13771377

@@ -1441,7 +1441,7 @@ public String getServiceName() {
14411441

14421442
@Override
14431443
public void run() {
1444-
CommitLog.log.info(this.getServiceName() + " service started");
1444+
CommitLog.log.info("{} service started", this.getServiceName());
14451445
while (!this.isStopped()) {
14461446
int interval = CommitLog.this.defaultMessageStore.getMessageStoreConfig().getCommitIntervalCommitLog();
14471447

@@ -1469,16 +1469,16 @@ public void run() {
14691469
}
14701470
this.waitForRunning(interval);
14711471
} catch (Throwable e) {
1472-
CommitLog.log.error(this.getServiceName() + " service has exception. ", e);
1472+
CommitLog.log.error("{} service has exception. ", this.getServiceName(), e);
14731473
}
14741474
}
14751475

14761476
boolean result = false;
14771477
for (int i = 0; i < RETRY_TIMES_OVER && !result; i++) {
14781478
result = CommitLog.this.mappedFileQueue.commit(0);
1479-
CommitLog.log.info(this.getServiceName() + " service shutdown, retry " + (i + 1) + " times " + (result ? "OK" : "Not OK"));
1479+
CommitLog.log.info("{} service shutdown, retry {} times {}", this.getServiceName(), i + 1, result ? "OK" : "Not OK");
14801480
}
1481-
CommitLog.log.info(this.getServiceName() + " service end");
1481+
CommitLog.log.info("{} service end", this.getServiceName());
14821482
}
14831483
}
14841484

@@ -1488,7 +1488,7 @@ class FlushRealTimeService extends FlushCommitLogService {
14881488

14891489
@Override
14901490
public void run() {
1491-
CommitLog.log.info(this.getServiceName() + " service started");
1491+
CommitLog.log.info("{} service started", this.getServiceName());
14921492

14931493
while (!this.isStopped()) {
14941494
boolean flushCommitLogTimed = CommitLog.this.defaultMessageStore.getMessageStoreConfig().isFlushCommitLogTimed();
@@ -1532,7 +1532,7 @@ public void run() {
15321532
log.info("Flush data to disk costs {} ms", past);
15331533
}
15341534
} catch (Throwable e) {
1535-
CommitLog.log.warn(this.getServiceName() + " service has exception. ", e);
1535+
CommitLog.log.warn("{} service has exception. ", this.getServiceName(), e);
15361536
this.printFlushProgress();
15371537
}
15381538
}
@@ -1541,12 +1541,12 @@ public void run() {
15411541
boolean result = false;
15421542
for (int i = 0; i < RETRY_TIMES_OVER && !result; i++) {
15431543
result = CommitLog.this.mappedFileQueue.flush(0);
1544-
CommitLog.log.info(this.getServiceName() + " service shutdown, retry " + (i + 1) + " times " + (result ? "OK" : "Not OK"));
1544+
CommitLog.log.info("{} service shutdown, retry {} times {}", this.getServiceName(), i + 1, result ? "OK" : "Not OK");
15451545
}
15461546

15471547
this.printFlushProgress();
15481548

1549-
CommitLog.log.info(this.getServiceName() + " service end");
1549+
CommitLog.log.info("{} service end", this.getServiceName());
15501550
}
15511551

15521552
@Override
@@ -1673,14 +1673,14 @@ private void doCommit() {
16731673

16741674
@Override
16751675
public void run() {
1676-
CommitLog.log.info(this.getServiceName() + " service started");
1676+
CommitLog.log.info("{} service started", this.getServiceName());
16771677

16781678
while (!this.isStopped()) {
16791679
try {
16801680
this.waitForRunning(10);
16811681
this.doCommit();
16821682
} catch (Exception e) {
1683-
CommitLog.log.warn(this.getServiceName() + " service has exception. ", e);
1683+
CommitLog.log.warn("{} service has exception. ", this.getServiceName(), e);
16841684
}
16851685
}
16861686

@@ -1695,7 +1695,7 @@ public void run() {
16951695
this.swapRequests();
16961696
this.doCommit();
16971697

1698-
CommitLog.log.info(this.getServiceName() + " service end");
1698+
CommitLog.log.info("{} service end", this.getServiceName());
16991699
}
17001700

17011701
@Override
@@ -1781,14 +1781,14 @@ private void doCommit() {
17811781
}
17821782

17831783
public void run() {
1784-
CommitLog.log.info(this.getServiceName() + " service started");
1784+
CommitLog.log.info("{} service started", this.getServiceName());
17851785

17861786
while (!this.isStopped()) {
17871787
try {
17881788
this.waitForRunning(1);
17891789
this.doCommit();
17901790
} catch (Exception e) {
1791-
CommitLog.log.warn(this.getServiceName() + " service has exception. ", e);
1791+
CommitLog.log.warn("{} service has exception. ", this.getServiceName(), e);
17921792
}
17931793
}
17941794

@@ -1806,7 +1806,7 @@ public void run() {
18061806

18071807
this.doCommit();
18081808

1809-
CommitLog.log.info(this.getServiceName() + " service end");
1809+
CommitLog.log.info("{} service end", this.getServiceName());
18101810
}
18111811

18121812
@Override
@@ -1880,7 +1880,7 @@ public AppendMessageResult handlePropertiesForLmqMsg(ByteBuffer preEncodeBuffer,
18801880

18811881
// Exceeds the maximum message
18821882
if (msgLen > this.messageStoreConfig.getMaxMessageSize()) {
1883-
log.warn("message size exceeded, msg total size: " + msgLen + ", maxMessageSize: " + this.messageStoreConfig.getMaxMessageSize());
1883+
log.warn("message size exceeded, msg total size: {}, maxMessageSize: {}", msgLen, this.messageStoreConfig.getMaxMessageSize());
18841884
return new AppendMessageResult(AppendMessageStatus.MESSAGE_SIZE_EXCEEDED);
18851885
}
18861886

@@ -2161,7 +2161,7 @@ public void handleDiskFlush(AppendMessageResult result, PutMessageResult putMess
21612161
//flushOK=false;
21622162
}
21632163
if (flushStatus != PutMessageStatus.PUT_OK) {
2164-
log.error("do groupcommit, wait for flush failed, topic: " + messageExt.getTopic() + " tags: " + messageExt.getTags() + " client address: " + messageExt.getBornHostString());
2164+
log.error("do groupcommit, wait for flush failed, topic: {} tags: {} client address: {}", messageExt.getTopic(), messageExt.getTags(), messageExt.getBornHostString());
21652165
putMessageResult.setPutMessageStatus(PutMessageStatus.FLUSH_DISK_TIMEOUT);
21662166
}
21672167
} else {
@@ -2311,7 +2311,7 @@ public void run() {
23112311
long costTime = this.systemClock.now() - beginClockTimestamp;
23122312
log.info("[{}] scanFilesInPageCache-cost {} ms.", costTime > 30 * 1000 ? "NOTIFYME" : "OK", costTime);
23132313
} catch (Throwable e) {
2314-
log.warn(this.getServiceName() + " service has e: {}", e);
2314+
log.warn("{} service has e: ", this.getServiceName() , e);
23152315
}
23162316
}
23172317
log.info("{} service end", this.getServiceName());

0 commit comments

Comments
 (0)