This is an automated email from the ASF dual-hosted git repository.

iluo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new 92fa9af  Remove unnecessary StringBuilder (#1388)
92fa9af is described below

commit 92fa9afe2760feb28833c09215e76a981ddcd9c7
Author: Ke Li <like_0...@163.com>
AuthorDate: Sun Apr 8 10:23:46 2018 +0800

    Remove unnecessary StringBuilder (#1388)
---
 .../dubbo/rpc/cluster/merger/ArrayMerger.java      |  4 +--
 .../cluster/support/MergeableClusterInvoker.java   | 31 +++++--------------
 .../support/MergeableClusterInvokerTest.java       |  4 +--
 .../dubbo/common/beanutil/JavaBeanDescriptor.java  |  4 +--
 .../alibaba/dubbo/common/utils/ExecutorUtil.java   |  2 +-
 .../exchange/support/header/HeartbeatHandler.java  |  6 +---
 .../alibaba/dubbo/rpc/filter/GenericFilter.java    | 25 ++++++++-------
 .../dubbo/rpc/filter/GenericImplFilter.java        | 26 ++++++++--------
 .../alibaba/dubbo/rpc/filter/TpsLimitFilter.java   | 12 +++-----
 .../dubbo/rpc/protocol/rest/RpcContextFilter.java  |  7 ++---
 .../dubbo/rpc/protocol/thrift/ThriftCodec.java     | 36 ++++++----------------
 .../protocol/thrift/ext/MultiServiceProcessor.java | 11 ++-----
 .../dubbo/examples/heartbeat/HeartbeatClient.java  |  6 +---
 .../dubbo/examples/heartbeat/HeartbeatServer.java  |  6 +---
 .../examples/heartbeat/impl/HelloServiceImpl.java  |  2 +-
 15 files changed, 57 insertions(+), 125 deletions(-)

diff --git 
a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/merger/ArrayMerger.java
 
b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/merger/ArrayMerger.java
index 8731389..443a51f 100644
--- 
a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/merger/ArrayMerger.java
+++ 
b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/merger/ArrayMerger.java
@@ -34,9 +34,7 @@ public class ArrayMerger implements Merger<Object[]> {
             if (item != null && item.getClass().isArray()) {
                 totalLen += Array.getLength(item);
             } else {
-                throw new IllegalArgumentException(
-                        new StringBuilder(32).append(i + 1)
-                                .append("th argument is not an 
array").toString());
+                throw new IllegalArgumentException(i + 1 + "th argument is not 
an array");
             }
         }
 
diff --git 
a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/support/MergeableClusterInvoker.java
 
b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/support/MergeableClusterInvoker.java
index 6237210..048d255 100644
--- 
a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/support/MergeableClusterInvoker.java
+++ 
b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/support/MergeableClusterInvoker.java
@@ -99,21 +99,14 @@ public class MergeableClusterInvoker<T> implements 
Invoker<T> {
             try {
                 Result r = future.get(timeout, TimeUnit.MILLISECONDS);
                 if (r.hasException()) {
-                    log.error(new StringBuilder(32).append("Invoke ")
-                                    
.append(getGroupDescFromServiceKey(entry.getKey()))
-                                    .append(" failed: ")
-                                    
.append(r.getException().getMessage()).toString(),
+                    log.error("Invoke " + 
getGroupDescFromServiceKey(entry.getKey()) + 
+                                    " failed: " + 
r.getException().getMessage(), 
                             r.getException());
                 } else {
                     resultList.add(r);
                 }
             } catch (Exception e) {
-                throw new RpcException(new StringBuilder(32)
-                        .append("Failed to invoke service ")
-                        .append(entry.getKey())
-                        .append(": ")
-                        .append(e.getMessage()).toString(),
-                        e);
+                throw new RpcException("Failed to invoke service " + 
entry.getKey() + ": " + e.getMessage(), e);
             }
         }
 
@@ -133,13 +126,8 @@ public class MergeableClusterInvoker<T> implements 
Invoker<T> {
             try {
                 method = returnType.getMethod(merger, returnType);
             } catch (NoSuchMethodException e) {
-                throw new RpcException(new StringBuilder(32)
-                        .append("Can not merge result because missing method [ 
")
-                        .append(merger)
-                        .append(" ] in class [ ")
-                        .append(returnType.getClass().getName())
-                        .append(" ]")
-                        .toString());
+                throw new RpcException("Can not merge result because missing 
method [ " + merger + " ] in class [ " + 
+                        returnType.getClass().getName() + " ]");
             }
             if (!Modifier.isPublic(method.getModifiers())) {
                 method.setAccessible(true);
@@ -157,11 +145,7 @@ public class MergeableClusterInvoker<T> implements 
Invoker<T> {
                     }
                 }
             } catch (Exception e) {
-                throw new RpcException(
-                        new StringBuilder(32)
-                                .append("Can not merge result: ")
-                                .append(e.getMessage()).toString(),
-                        e);
+                throw new RpcException("Can not merge result: " + 
e.getMessage(), e);
             }
         } else {
             Merger resultMerger;
@@ -203,8 +187,7 @@ public class MergeableClusterInvoker<T> implements 
Invoker<T> {
     private String getGroupDescFromServiceKey(String key) {
         int index = key.indexOf("/");
         if (index > 0) {
-            return new StringBuilder(32).append("group [ ")
-                    .append(key.substring(0, index)).append(" ]").toString();
+            return "group [ " + key.substring(0, index) + " ]";
         }
         return key;
     }
diff --git 
a/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/MergeableClusterInvokerTest.java
 
b/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/MergeableClusterInvokerTest.java
index 3da49da..c8d8e39 100644
--- 
a/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/MergeableClusterInvokerTest.java
+++ 
b/dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/support/MergeableClusterInvokerTest.java
@@ -71,9 +71,7 @@ public class MergeableClusterInvokerTest {
     private Menu firstMenu = new Menu(firstMenuMap);
     private Menu secondMenu = new Menu(secondMenuMap);
 
-    private URL url = URL.valueOf(new StringBuilder(32)
-            .append("test://test/")
-            .append(MenuService.class.getName()).toString());
+    private URL url = URL.valueOf("test://test/" + 
MenuService.class.getName());
 
     static void merge(Map<String, List<String>> first, Map<String, 
List<String>> second) {
         for (Map.Entry<String, List<String>> entry : second.entrySet()) {
diff --git 
a/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanDescriptor.java
 
b/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanDescriptor.java
index ab60606..1bdeaab 100644
--- 
a/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanDescriptor.java
+++ 
b/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanDescriptor.java
@@ -67,9 +67,7 @@ public final class JavaBeanDescriptor implements 
Serializable, Iterable<Map.Entr
     public JavaBeanDescriptor(String className, int type) {
         notEmpty(className, "class name is empty");
         if (!isValidType(type)) {
-            throw new IllegalArgumentException(
-                    new StringBuilder(16).append("type [ ")
-                            .append(type).append(" ] is 
unsupported").toString());
+            throw new IllegalArgumentException("type [ " + type + " ] is 
unsupported");
         }
 
         this.className = className;
diff --git 
a/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ExecutorUtil.java 
b/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ExecutorUtil.java
index eea7483..d777c0f 100644
--- 
a/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ExecutorUtil.java
+++ 
b/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/ExecutorUtil.java
@@ -118,7 +118,7 @@ public class ExecutorUtil {
      */
     public static URL setThreadName(URL url, String defaultName) {
         String name = url.getParameter(Constants.THREAD_NAME_KEY, defaultName);
-        name = new 
StringBuilder(32).append(name).append("-").append(url.getAddress()).toString();
+        name = name + "-" + url.getAddress();
         url = url.addParameter(Constants.THREAD_NAME_KEY, name);
         return url;
     }
diff --git 
a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/support/header/HeartbeatHandler.java
 
b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/support/header/HeartbeatHandler.java
index ae88f8c..7cdffb5 100644
--- 
a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/support/header/HeartbeatHandler.java
+++ 
b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/support/header/HeartbeatHandler.java
@@ -77,11 +77,7 @@ public class HeartbeatHandler extends 
AbstractChannelHandlerDelegate {
         }
         if (isHeartbeatResponse(message)) {
             if (logger.isDebugEnabled()) {
-                logger.debug(
-                        new StringBuilder(32)
-                                .append("Receive heartbeat response in thread 
")
-                                .append(Thread.currentThread().getName())
-                                .toString());
+                logger.debug("Receive heartbeat response in thread " + 
Thread.currentThread().getName());
             }
             return;
         }
diff --git 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/GenericFilter.java
 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/GenericFilter.java
index 231d74d..f5df8de 100644
--- 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/GenericFilter.java
+++ 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/GenericFilter.java
@@ -78,12 +78,12 @@ public class GenericFilter implements Filter {
                             }
                         } else {
                             throw new RpcException(
-                                    new StringBuilder(32).append("Generic 
serialization [")
-                                            
.append(Constants.GENERIC_SERIALIZATION_NATIVE_JAVA)
-                                            .append("] only support message 
type ")
-                                            .append(byte[].class)
-                                            .append(" and your message type is 
")
-                                            
.append(args[i].getClass()).toString());
+                                    "Generic serialization [" +
+                                            
Constants.GENERIC_SERIALIZATION_NATIVE_JAVA +
+                                            "] only support message type " +
+                                            byte[].class +
+                                            " and your message type is " +
+                                            args[i].getClass());
                         }
                     }
                 } else if (ProtocolUtils.isBeanGenericSerialization(generic)) {
@@ -92,13 +92,12 @@ public class GenericFilter implements Filter {
                             args[i] = 
JavaBeanSerializeUtil.deserialize((JavaBeanDescriptor) args[i]);
                         } else {
                             throw new RpcException(
-                                    new StringBuilder(32)
-                                            .append("Generic serialization [")
-                                            
.append(Constants.GENERIC_SERIALIZATION_BEAN)
-                                            .append("] only support message 
type ")
-                                            
.append(JavaBeanDescriptor.class.getName())
-                                            .append(" and your message type is 
")
-                                            
.append(args[i].getClass().getName()).toString());
+                                    "Generic serialization [" +
+                                            
Constants.GENERIC_SERIALIZATION_BEAN +
+                                            "] only support message type " +
+                                            JavaBeanDescriptor.class.getName() 
+
+                                            " and your message type is " +
+                                            args[i].getClass().getName());
                         }
                     }
                 }
diff --git 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/GenericImplFilter.java
 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/GenericImplFilter.java
index f79baa1..307c755 100644
--- 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/GenericImplFilter.java
+++ 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/GenericImplFilter.java
@@ -90,13 +90,12 @@ public class GenericImplFilter implements Filter {
                             return new 
RpcResult(JavaBeanSerializeUtil.deserialize((JavaBeanDescriptor) value));
                         } else {
                             throw new RpcException(
-                                    new StringBuilder(64)
-                                            .append("The type of result value 
is ")
-                                            .append(value.getClass().getName())
-                                            .append(" other than ")
-                                            
.append(JavaBeanDescriptor.class.getName())
-                                            .append(", and the result is ")
-                                            .append(value).toString());
+                                    "The type of result value is " +
+                                            value.getClass().getName() +
+                                            " other than " +
+                                            JavaBeanDescriptor.class.getName() 
+
+                                            ", and the result is " +
+                                            value);
                         }
                     } else {
                         return new RpcResult(PojoUtils.realize(value, 
method.getReturnType(), method.getGenericReturnType()));
@@ -174,13 +173,12 @@ public class GenericImplFilter implements Filter {
 
     private void error(String expected, String actual) throws RpcException {
         throw new RpcException(
-                new StringBuilder(32)
-                        .append("Generic serialization [")
-                        .append(Constants.GENERIC_SERIALIZATION_NATIVE_JAVA)
-                        .append("] only support message type ")
-                        .append(expected)
-                        .append(" and your message type is ")
-                        .append(actual).toString());
+                "Generic serialization [" +
+                        Constants.GENERIC_SERIALIZATION_NATIVE_JAVA +
+                        "] only support message type " +
+                        expected +
+                        " and your message type is " +
+                        actual);
     }
 
 }
\ No newline at end of file
diff --git 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/TpsLimitFilter.java
 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/TpsLimitFilter.java
index 0b5eafc..dc710ef 100644
--- 
a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/TpsLimitFilter.java
+++ 
b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/filter/TpsLimitFilter.java
@@ -39,13 +39,11 @@ public class TpsLimitFilter implements Filter {
 
         if (!tpsLimiter.isAllowable(invoker.getUrl(), invocation)) {
             throw new RpcException(
-                    new StringBuilder(64)
-                            .append("Failed to invoke service ")
-                            .append(invoker.getInterface().getName())
-                            .append(".")
-                            .append(invocation.getMethodName())
-                            .append(" because exceed max service tps.")
-                            .toString());
+                    "Failed to invoke service " +
+                            invoker.getInterface().getName() +
+                            "." +
+                            invocation.getMethodName() +
+                            " because exceed max service tps.");
         }
 
         return invoker.invoke(invocation);
diff --git 
a/dubbo-rpc/dubbo-rpc-rest/src/main/java/com/alibaba/dubbo/rpc/protocol/rest/RpcContextFilter.java
 
b/dubbo-rpc/dubbo-rpc-rest/src/main/java/com/alibaba/dubbo/rpc/protocol/rest/RpcContextFilter.java
index f250425..644fe92 100644
--- 
a/dubbo-rpc/dubbo-rpc-rest/src/main/java/com/alibaba/dubbo/rpc/protocol/rest/RpcContextFilter.java
+++ 
b/dubbo-rpc/dubbo-rpc-rest/src/main/java/com/alibaba/dubbo/rpc/protocol/rest/RpcContextFilter.java
@@ -79,11 +79,8 @@ public class RpcContextFilter implements 
ContainerRequestFilter, ClientRequestFi
                 throw new IllegalArgumentException("The attachments of " + 
RpcContext.class.getSimpleName() + " is too big");
             }
 
-            StringBuilder attachments = new StringBuilder();
-            attachments.append(entry.getKey());
-            attachments.append("=");
-            attachments.append(entry.getValue());
-            requestContext.getHeaders().add(DUBBO_ATTACHMENT_HEADER, 
attachments.toString());
+            String attachments = entry.getKey() + "=" + entry.getValue();
+            requestContext.getHeaders().add(DUBBO_ATTACHMENT_HEADER, 
attachments);
         }
     }
 }
diff --git 
a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ThriftCodec.java
 
b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ThriftCodec.java
index ced6439..873a5c2 100644
--- 
a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ThriftCodec.java
+++ 
b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ThriftCodec.java
@@ -104,13 +104,8 @@ public class ThriftCodec implements Codec2 {
         } else if (message instanceof Response) {
             encodeResponse(channel, buffer, (Response) message);
         } else {
-            throw new UnsupportedOperationException(
-                    new StringBuilder(32)
-                            .append("Thrift codec only support encode ")
-                            .append(Request.class.getName())
-                            .append(" and ")
-                            .append(Response.class.getName())
-                            .toString());
+            throw new UnsupportedOperationException("Thrift codec only support 
encode " 
+                    + Request.class.getName() + " and " + 
Response.class.getName());
         }
 
     }
@@ -144,11 +139,7 @@ public class ThriftCodec implements Codec2 {
             }
 
             if (MAGIC != magic) {
-                throw new IOException(
-                        new StringBuilder(32)
-                                .append("Unknown magic code ")
-                                .append(magic)
-                                .toString());
+                throw new IOException("Unknown magic code " + magic);
             }
 
             if (available < messageLength) {
@@ -303,12 +294,8 @@ public class ThriftCodec implements Codec2 {
                     
.getExtension(ThriftClassNameGenerator.NAME).generateResultClassName(serviceName,
 message.name);
 
             if (StringUtils.isEmpty(resultClassName)) {
-                throw new IllegalArgumentException(
-                        new StringBuilder(32)
-                                .append("Could not infer service result class 
name from service name ")
-                                .append(serviceName)
-                                .append(", the service name you specified may 
not generated by thrift idl compiler")
-                                .toString());
+                throw new IllegalArgumentException("Could not infer service 
result class name from service name " 
+                        + serviceName + ", the service name you specified may 
not generated by thrift idl compiler");
             }
 
             Class<?> clazz = cachedClass.get(resultClassName);
@@ -409,11 +396,8 @@ public class ThriftCodec implements Codec2 {
         String serviceName = inv.getAttachment(Constants.INTERFACE_KEY);
 
         if (StringUtils.isEmpty(serviceName)) {
-            throw new IllegalArgumentException(
-                    new StringBuilder(32)
-                            .append("Could not find service name in attachment 
with key ")
-                            .append(Constants.INTERFACE_KEY)
-                            .toString());
+            throw new IllegalArgumentException("Could not find service name in 
attachment with key " 
+                    + Constants.INTERFACE_KEY);
         }
 
         TMessage message = new TMessage(
@@ -427,8 +411,7 @@ public class ThriftCodec implements Codec2 {
 
         if (StringUtils.isEmpty(methodArgs)) {
             throw new RpcException(RpcException.SERIALIZATION_EXCEPTION,
-                    new StringBuilder(32).append(
-                            "Could not encode request, the specified interface 
may be incorrect.").toString());
+                    "Could not encode request, the specified interface may be 
incorrect.");
         }
 
         Class<?> clazz = cachedClass.get(methodArgs);
@@ -553,8 +536,7 @@ public class ThriftCodec implements Codec2 {
 
         if (StringUtils.isEmpty(resultClassName)) {
             throw new RpcException(RpcException.SERIALIZATION_EXCEPTION,
-                    new StringBuilder(32).append(
-                            "Could not encode response, the specified 
interface may be incorrect.").toString());
+                    "Could not encode response, the specified interface may be 
incorrect.");
         }
 
         Class clazz = cachedClass.get(resultClassName);
diff --git 
a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ext/MultiServiceProcessor.java
 
b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ext/MultiServiceProcessor.java
index 5877d9c..72075aa 100644
--- 
a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ext/MultiServiceProcessor.java
+++ 
b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ext/MultiServiceProcessor.java
@@ -47,10 +47,7 @@ public class MultiServiceProcessor implements TProcessor {
         short magic = in.readI16();
 
         if (magic != ThriftCodec.MAGIC) {
-            logger.error(
-                    new StringBuilder(24)
-                            .append("Unsupported magic ")
-                            .append(magic).toString());
+            logger.error("Unsupported magic " + magic);
             return false;
         }
 
@@ -69,11 +66,7 @@ public class MultiServiceProcessor implements TProcessor {
         TProcessor processor = processorMap.get(serviceName);
 
         if (processor == null) {
-            logger.error(
-                    new StringBuilder(32)
-                            .append("Could not find processor for service ")
-                            .append(serviceName)
-                            .toString());
+            logger.error("Could not find processor for service " + 
serviceName);
             return false;
         }
 
diff --git 
a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/heartbeat/HeartbeatClient.java
 
b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/heartbeat/HeartbeatClient.java
index 9a03b11..dd6b444 100644
--- 
a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/heartbeat/HeartbeatClient.java
+++ 
b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/heartbeat/HeartbeatClient.java
@@ -29,11 +29,7 @@ import 
com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeServer;
 
 public class HeartbeatClient {
 
-    private static final URL serverUrl = URL.valueOf(
-            new StringBuilder(32)
-                    .append("netty://")
-                    .append(NetUtils.getLocalHost())
-                    .append(":9999").toString())
+    private static final URL serverUrl = URL.valueOf("netty://" + 
NetUtils.getLocalHost() + ":9999")
             .addParameter(Constants.CODEC_KEY, "exchange");
 
     private static final ExchangeHandler handler = new 
ExchangeHandlerAdapter() {
diff --git 
a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/heartbeat/HeartbeatServer.java
 
b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/heartbeat/HeartbeatServer.java
index 611c15d..2bf8917 100644
--- 
a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/heartbeat/HeartbeatServer.java
+++ 
b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/heartbeat/HeartbeatServer.java
@@ -29,11 +29,7 @@ import 
com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeServer;
 
 public class HeartbeatServer {
 
-    private static final URL clientUrl = URL.valueOf(
-            new StringBuilder(32)
-                    .append("netty://")
-                    .append(NetUtils.getLocalHost())
-                    .append(":9999").toString())
+    private static final URL clientUrl = URL.valueOf("netty://" + 
NetUtils.getLocalHost() + ":9999")
             .addParameter(Constants.CODEC_KEY, "exchange");
 
     private static final ExchangeHandler handler = new 
ExchangeHandlerAdapter() {
diff --git 
a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/heartbeat/impl/HelloServiceImpl.java
 
b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/heartbeat/impl/HelloServiceImpl.java
index a49e63f..c3f98c2 100644
--- 
a/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/heartbeat/impl/HelloServiceImpl.java
+++ 
b/dubbo-test/dubbo-test-examples/src/main/java/com/alibaba/dubbo/examples/heartbeat/impl/HelloServiceImpl.java
@@ -21,6 +21,6 @@ import com.alibaba.dubbo.examples.heartbeat.api.HelloService;
 public class HelloServiceImpl implements HelloService {
 
     public String sayHello(String name) {
-        return new StringBuilder(32).append("Hello, 
").append(name).append("!").toString();
+        return "Hello, " + name + "!";
     }
 }

-- 
To stop receiving notification emails like this one, please contact
i...@apache.org.

Reply via email to