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

liujun 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 7c21627  Merge pull request #1643, ChannelState branch prediction 
optimization.
7c21627 is described below

commit 7c216278a9d9d50e9ea2f1d86356295839ea2a23
Author: hengyunabc <hengyun...@gmail.com>
AuthorDate: Fri May 18 14:49:35 2018 +0800

    Merge pull request #1643, ChannelState branch prediction optimization.
---
 .../transport/dispatcher/ChannelEventRunnable.java  | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git 
a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/dispatcher/ChannelEventRunnable.java
 
b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/dispatcher/ChannelEventRunnable.java
index 038adea..44dea94 100644
--- 
a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/dispatcher/ChannelEventRunnable.java
+++ 
b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/dispatcher/ChannelEventRunnable.java
@@ -52,7 +52,15 @@ public class ChannelEventRunnable implements Runnable {
 
     @Override
     public void run() {
-        switch (state) {
+        if (state == ChannelState.RECEIVED) {
+            try {
+                handler.received(channel, message);
+            } catch (Exception e) {
+                logger.warn("ChannelEventRunnable handle " + state + " 
operation error, channel is " + channel
+                        + ", message is " + message, e);
+            }
+        } else {
+            switch (state) {
             case CONNECTED:
                 try {
                     handler.connected(channel);
@@ -74,15 +82,6 @@ public class ChannelEventRunnable implements Runnable {
                     logger.warn("ChannelEventRunnable handle " + state + " 
operation error, channel is " + channel
                             + ", message is " + message, e);
                 }
-                break;
-            case RECEIVED:
-                try {
-                    handler.received(channel, message);
-                } catch (Exception e) {
-                    logger.warn("ChannelEventRunnable handle " + state + " 
operation error, channel is " + channel
-                            + ", message is " + message, e);
-                }
-                break;
             case CAUGHT:
                 try {
                     handler.caught(channel, exception);
@@ -93,7 +92,9 @@ public class ChannelEventRunnable implements Runnable {
                 break;
             default:
                 logger.warn("unknown state: " + state + ", message is " + 
message);
+            }
         }
+
     }
 
     /**

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

Reply via email to