Skip to content

Commit a17dc54

Browse files
authored
enhance comments, javadoc and logging message for (apache#1722)
ExecutionChannelHandler
1 parent 01e100d commit a17dc54

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929

3030
import java.util.concurrent.RejectedExecutionException;
3131

32+
/**
33+
* Only request message will be dispatched to thread pool. Other messages like response, connect, disconnect,
34+
* heartbeat will be directly executed by I/O thread.
35+
*/
3236
public class ExecutionChannelHandler extends WrappedChannelHandler {
3337

3438
public ExecutionChannelHandler(ChannelHandler handler, URL url) {
@@ -41,21 +45,22 @@ public void received(Channel channel, Object message) throws RemotingException {
4145
try {
4246
executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message));
4347
} 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
48+
// FIXME: when the thread pool is full, SERVER_THREADPOOL_EXHAUSTED_ERROR cannot return properly,
49+
// therefore the consumer side has to wait until gets timeout. This is a temporary solution to prevent
50+
// this scenario from happening, but a better solution should be considered later.
4651
if (t instanceof RejectedExecutionException) {
4752
Request request = (Request) message;
4853
if (request.isTwoWay()) {
4954
String msg = "Server side(" + url.getIp() + "," + url.getPort()
50-
+ ") threadpool is exhausted ,detail msg:" + t.getMessage();
55+
+ ") thread pool is exhausted, detail msg:" + t.getMessage();
5156
Response response = new Response(request.getId(), request.getVersion());
5257
response.setStatus(Response.SERVER_THREADPOOL_EXHAUSTED_ERROR);
5358
response.setErrorMessage(msg);
5459
channel.send(response);
5560
return;
5661
}
5762
}
58-
throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);
63+
throw new ExecutionException(message, channel, getClass() + " error when process received event.", t);
5964
}
6065
} else {
6166
handler.received(channel, message);

0 commit comments

Comments
 (0)