diff --git a/client/src/main/java/org/apache/rocketmq/client/ClientConfig.java b/client/src/main/java/org/apache/rocketmq/client/ClientConfig.java index 4e56d4b1f8c38a632043c4129742a7e68cd57e9b..3ab214b8db6437f21ab13b0fb615bbaec89409e7 100644 --- a/client/src/main/java/org/apache/rocketmq/client/ClientConfig.java +++ b/client/src/main/java/org/apache/rocketmq/client/ClientConfig.java @@ -94,7 +94,7 @@ public class ClientConfig { public void changeInstanceNameToPID() { if (this.instanceName.equals("DEFAULT")) { - this.instanceName = UtilAll.getPid()+ "#" + System.nanoTime(); + this.instanceName = UtilAll.getPid() + "#" + System.nanoTime(); } } diff --git a/common/src/main/java/org/apache/rocketmq/common/utils/NameServerAddressUtils.java b/common/src/main/java/org/apache/rocketmq/common/utils/NameServerAddressUtils.java index 955e39d38aa612643b3c5648ff2bc1cbf29e9ccb..85dc95feb4c796374db0d1628c798fe7f4febc29 100644 --- a/common/src/main/java/org/apache/rocketmq/common/utils/NameServerAddressUtils.java +++ b/common/src/main/java/org/apache/rocketmq/common/utils/NameServerAddressUtils.java @@ -34,7 +34,7 @@ public class NameServerAddressUtils { if (StringUtils.isEmpty(endpoint)) { return null; } - return endpoint.substring(endpoint.lastIndexOf("/")+1, endpoint.indexOf('.')); + return endpoint.substring(endpoint.lastIndexOf("/") + 1, endpoint.indexOf('.')); } public static String getNameSrvAddrFromNamesrvEndpoint(String nameSrvEndpoint) { diff --git a/example/src/main/java/org/apache/rocketmq/example/ordermessage/Producer.java b/example/src/main/java/org/apache/rocketmq/example/ordermessage/Producer.java index ba8ef4d53542308b9aba715b32e8174b3483ab01..c5d864fa3f6acae04489cc1a089b9d332c4b9d56 100644 --- a/example/src/main/java/org/apache/rocketmq/example/ordermessage/Producer.java +++ b/example/src/main/java/org/apache/rocketmq/example/ordermessage/Producer.java @@ -16,12 +16,9 @@ */ package org.apache.rocketmq.example.ordermessage; -import java.io.UnsupportedEncodingException; -import java.util.List; import org.apache.rocketmq.client.exception.MQBrokerException; import org.apache.rocketmq.client.exception.MQClientException; import org.apache.rocketmq.client.producer.DefaultMQProducer; -import org.apache.rocketmq.client.producer.MQProducer; import org.apache.rocketmq.client.producer.MessageQueueSelector; import org.apache.rocketmq.client.producer.SendResult; import org.apache.rocketmq.common.message.Message; @@ -29,6 +26,9 @@ import org.apache.rocketmq.common.message.MessageQueue; import org.apache.rocketmq.remoting.common.RemotingHelper; import org.apache.rocketmq.remoting.exception.RemotingException; +import java.io.UnsupportedEncodingException; +import java.util.List; + public class Producer { public static void main(String[] args) throws UnsupportedEncodingException { try {