RongtongJin commented on a change in pull request #2213:
URL: https://github.com/apache/rocketmq/pull/2213#discussion_r462060668



##########
File path: 
remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java
##########
@@ -61,10 +61,13 @@
     static {
         final String protocol = System.getProperty(SERIALIZE_TYPE_PROPERTY, 
System.getenv(SERIALIZE_TYPE_ENV));
         if (!isBlank(protocol)) {
+            byte protocolByte = -1;
             try {
-                serializeTypeConfigInThisServer = 
SerializeType.valueOf(protocol);
+                protocolByte = (byte) Integer.parseInt(protocol);
+                System.out.println(protocolByte);

Review comment:
       IMO, we should delete these two codes.

##########
File path: 
remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java
##########
@@ -61,10 +61,13 @@
     static {
         final String protocol = System.getProperty(SERIALIZE_TYPE_PROPERTY, 
System.getenv(SERIALIZE_TYPE_ENV));
         if (!isBlank(protocol)) {
+            byte protocolByte = -1;
             try {
-                serializeTypeConfigInThisServer = 
SerializeType.valueOf(protocol);
+                protocolByte = (byte) Integer.parseInt(protocol);
+                System.out.println(protocolByte);
+                serializeTypeConfigInThisServer = 
SerializeType.valueOf(protocolByte);
             } catch (IllegalArgumentException e) {
-                throw new RuntimeException("parser specified protocol error. 
protocol=" + protocol, e);
+                throw new RuntimeException("parser specified protocol error. 
protocol=" + serializeTypeConfigInThisServer, e);
             }

Review comment:
       IMO, No need to catch the runtime exception and rethrow it

##########
File path: 
remoting/src/main/java/org/apache/rocketmq/remoting/protocol/RemotingCommand.java
##########
@@ -61,10 +61,13 @@
     static {
         final String protocol = System.getProperty(SERIALIZE_TYPE_PROPERTY, 
System.getenv(SERIALIZE_TYPE_ENV));
         if (!isBlank(protocol)) {
+            byte protocolByte = -1;
             try {
-                serializeTypeConfigInThisServer = 
SerializeType.valueOf(protocol);
+                protocolByte = (byte) Integer.parseInt(protocol);
+                System.out.println(protocolByte);

Review comment:
       You are right , just delete `System.out.println(protocolByte);`.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to