You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/06/16 15:37:16 UTC

[GitHub] [dubbo] noobyu6 opened a new issue, #10171: Code optimization suggestions

noobyu6 opened a new issue, #10171:
URL: https://github.com/apache/dubbo/issues/10171

   <!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
   
   <!-- For all design discussions please continue. -->
   Hi,
   
   I find that the private field invocation at Line 47 in the file 'dubbo/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/ReflectionAbstractServerCall.java ' on the 3.0 branch is only assigned and used in the method trySetListener. Therefore, this field can be removed from the class, and become a local variable in the method trySetListener. This transformation will normally reduce memory usage and improve readability of your code.I will be happy if this transformation is helpful.
   
   ```java
       private RpcInvocation invocation; // line 47 this field can be replaced by local variable
   
       private void trySetListener() {
           if (listener != null) {
               return;
           }
           if (methodDescriptor == null) {
               return;
           }
           if (isClosed()) {
               return;
           }
         	// RpcInvocation invocation = buildInvocation(methodDescriptor);
           invocation = buildInvocation(methodDescriptor);
           if (isClosed()) {
               return;
           }
           headerFilters.forEach(f -> f.invoke(invoker, invocation));
           if (isClosed()) {
               return;
           }
           listener = ReflectionAbstractServerCall.this.startInternalCall(invocation,
               methodDescriptor, invoker);
       }
   ```
   
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ commented on issue #10171: Code optimization suggestions

Posted by GitBox <gi...@apache.org>.
AlbumenJ commented on issue #10171:
URL: https://github.com/apache/dubbo/issues/10171#issuecomment-1161101210

   Would you please submit a pr related with this issue?


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo] AlbumenJ closed issue #10171: Code optimization suggestions

Posted by GitBox <gi...@apache.org>.
AlbumenJ closed issue #10171: Code optimization suggestions
URL: https://github.com/apache/dubbo/issues/10171


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org