Skip to content

Commit 080e8ef

Browse files
qctbeiwei30
authored andcommitted
fixes #1089, make ExecutionDispatcher meet dubbo-user-book (#1449)
* fixes #1089, make ExecutionDispatcher meets dubbo-user-book * remove heartbeat condition
1 parent 9e9e778 commit 080e8ef

File tree

1 file changed

+22
-34
lines changed

1 file changed

+22
-34
lines changed

dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/dispatcher/execution/ExecutionChannelHandler.java

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -35,42 +35,30 @@ public ExecutionChannelHandler(ChannelHandler handler, URL url) {
3535
super(handler, url);
3636
}
3737

38-
@Override
39-
public void connected(Channel channel) throws RemotingException {
40-
executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.CONNECTED));
41-
}
42-
43-
@Override
44-
public void disconnected(Channel channel) throws RemotingException {
45-
executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.DISCONNECTED));
46-
}
47-
4838
@Override
4939
public void received(Channel channel, Object message) throws RemotingException {
50-
try {
51-
executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message));
52-
} catch (Throwable t) {
53-
//TODO A temporary solution to the problem that the exception information can not be sent to the opposite end after the thread pool is full. Need a refactoring
54-
//fix The thread pool is full, refuses to call, does not return, and causes the consumer to wait for time out
55-
if(message instanceof Request &&
56-
t instanceof RejectedExecutionException){
57-
Request request = (Request)message;
58-
if(request.isTwoWay()){
59-
String msg = "Server side("+url.getIp()+","+url.getPort()+") threadpool is exhausted ,detail msg:"+t.getMessage();
60-
Response response = new Response(request.getId(), request.getVersion());
61-
response.setStatus(Response.SERVER_THREADPOOL_EXHAUSTED_ERROR);
62-
response.setErrorMessage(msg);
63-
channel.send(response);
64-
return;
65-
}
66-
}
67-
throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);
40+
if (message instanceof Request) {
41+
try {
42+
executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message));
43+
} catch (Throwable t) {
44+
//TODO A temporary solution to the problem that the exception information can not be sent to the opposite end after the thread pool is full. Need a refactoring
45+
//fix The thread pool is full, refuses to call, does not return, and causes the consumer to wait for time out
46+
if (t instanceof RejectedExecutionException) {
47+
Request request = (Request) message;
48+
if (request.isTwoWay()) {
49+
String msg = "Server side(" + url.getIp() + "," + url.getPort()
50+
+ ") threadpool is exhausted ,detail msg:" + t.getMessage();
51+
Response response = new Response(request.getId(), request.getVersion());
52+
response.setStatus(Response.SERVER_THREADPOOL_EXHAUSTED_ERROR);
53+
response.setErrorMessage(msg);
54+
channel.send(response);
55+
return;
56+
}
57+
}
58+
throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);
59+
}
60+
} else {
61+
handler.received(channel, message);
6862
}
6963
}
70-
71-
@Override
72-
public void caught(Channel channel, Throwable exception) throws RemotingException {
73-
executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.CAUGHT, exception));
74-
}
75-
7664
}

0 commit comments

Comments
 (0)