From 7a359956346a51aa8b77741f54f8f5cd28996f93 Mon Sep 17 00:00:00 2001 From: RosaDreaming <948482592@qq.com> Date: Mon, 15 Jun 2020 12:35:21 +0800 Subject: [PATCH] [ISSUE #2082] Use StringBuilder instead of StringBuffer. (#2087) * stringbuilder replace Co-authored-by: qunlin.yi --- .../rocketmq/common/protocol/NamespaceUtil.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/src/main/java/org/apache/rocketmq/common/protocol/NamespaceUtil.java b/common/src/main/java/org/apache/rocketmq/common/protocol/NamespaceUtil.java index 4827844d..704eb90b 100644 --- a/common/src/main/java/org/apache/rocketmq/common/protocol/NamespaceUtil.java +++ b/common/src/main/java/org/apache/rocketmq/common/protocol/NamespaceUtil.java @@ -39,19 +39,19 @@ public class NamespaceUtil { return resourceWithNamespace; } - StringBuffer strBuffer = new StringBuffer(); + StringBuilder stringBuilder = new StringBuilder(); if (isRetryTopic(resourceWithNamespace)) { - strBuffer.append(MixAll.RETRY_GROUP_TOPIC_PREFIX); + stringBuilder.append(MixAll.RETRY_GROUP_TOPIC_PREFIX); } if (isDLQTopic(resourceWithNamespace)) { - strBuffer.append(MixAll.DLQ_GROUP_TOPIC_PREFIX); + stringBuilder.append(MixAll.DLQ_GROUP_TOPIC_PREFIX); } String resourceWithoutRetryAndDLQ = withOutRetryAndDLQ(resourceWithNamespace); int index = resourceWithoutRetryAndDLQ.indexOf(NAMESPACE_SEPARATOR); if (index > 0) { String resourceWithoutNamespace = resourceWithoutRetryAndDLQ.substring(index + 1); - return strBuffer.append(resourceWithoutNamespace).toString(); + return stringBuilder.append(resourceWithoutNamespace).toString(); } return resourceWithNamespace; @@ -91,17 +91,17 @@ public class NamespaceUtil { } String resourceWithoutRetryAndDLQ = withOutRetryAndDLQ(resourceWithOutNamespace); - StringBuffer strBuffer = new StringBuffer(); + StringBuilder stringBuilder = new StringBuilder(); if (isRetryTopic(resourceWithOutNamespace)) { - strBuffer.append(MixAll.RETRY_GROUP_TOPIC_PREFIX); + stringBuilder.append(MixAll.RETRY_GROUP_TOPIC_PREFIX); } if (isDLQTopic(resourceWithOutNamespace)) { - strBuffer.append(MixAll.DLQ_GROUP_TOPIC_PREFIX); + stringBuilder.append(MixAll.DLQ_GROUP_TOPIC_PREFIX); } - return strBuffer.append(namespace).append(NAMESPACE_SEPARATOR).append(resourceWithoutRetryAndDLQ).toString(); + return stringBuilder.append(namespace).append(NAMESPACE_SEPARATOR).append(resourceWithoutRetryAndDLQ).toString(); } -- GitLab