Skip to content
Permalink
Browse files
Merge pull request #1643, ChannelState branch prediction optimization.
  • Loading branch information
hengyunabc authored and chickenlj committed May 18, 2018
1 parent 2354c16 commit 7c216278a9d9d50e9ea2f1d86356295839ea2a23
Showing 1 changed file with 11 additions and 10 deletions.
@@ -52,7 +52,15 @@ public ChannelEventRunnable(Channel channel, ChannelHandler handler, ChannelStat

@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 void run() {
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 void run() {
break;
default:
logger.warn("unknown state: " + state + ", message is " + message);
}
}

}

/**

0 comments on commit 7c21627

Please sign in to comment.