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 2018/04/30 10:01:18 UTC

[GitHub] beiwei30 closed pull request #1449: fixes #1089, make ExecutionDispatcher meet dubbo-user-book

beiwei30 closed pull request #1449: fixes #1089, make ExecutionDispatcher meet dubbo-user-book
URL: https://github.com/apache/incubator-dubbo/pull/1449
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/dispatcher/execution/ExecutionChannelHandler.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/dispatcher/execution/ExecutionChannelHandler.java
index 2cb4634860..91b5804317 100644
--- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/dispatcher/execution/ExecutionChannelHandler.java
+++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/transport/dispatcher/execution/ExecutionChannelHandler.java
@@ -35,42 +35,30 @@ public ExecutionChannelHandler(ChannelHandler handler, URL url) {
         super(handler, url);
     }
 
-    @Override
-    public void connected(Channel channel) throws RemotingException {
-        executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.CONNECTED));
-    }
-
-    @Override
-    public void disconnected(Channel channel) throws RemotingException {
-        executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.DISCONNECTED));
-    }
-
     @Override
     public void received(Channel channel, Object message) throws RemotingException {
-    	try {
-            executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message));
-        } catch (Throwable t) {
-            //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
-            //fix The thread pool is full, refuses to call, does not return, and causes the consumer to wait for time out
-        	if(message instanceof Request &&
-        			t instanceof RejectedExecutionException){
-        		Request request = (Request)message;
-        		if(request.isTwoWay()){
-        			String msg = "Server side("+url.getIp()+","+url.getPort()+") threadpool is exhausted ,detail msg:"+t.getMessage();
-        			Response response = new Response(request.getId(), request.getVersion());
-        			response.setStatus(Response.SERVER_THREADPOOL_EXHAUSTED_ERROR);
-        			response.setErrorMessage(msg);
-        			channel.send(response);
-        			return;
-        		}
-        	}
-            throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);
+        if (message instanceof Request) {
+            try {
+                executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message));
+            } catch (Throwable t) {
+                //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
+                //fix The thread pool is full, refuses to call, does not return, and causes the consumer to wait for time out
+                if (t instanceof RejectedExecutionException) {
+                    Request request = (Request) message;
+                    if (request.isTwoWay()) {
+                        String msg = "Server side(" + url.getIp() + "," + url.getPort()
+                            + ") threadpool is exhausted ,detail msg:" + t.getMessage();
+                        Response response = new Response(request.getId(), request.getVersion());
+                        response.setStatus(Response.SERVER_THREADPOOL_EXHAUSTED_ERROR);
+                        response.setErrorMessage(msg);
+                        channel.send(response);
+                        return;
+                    }
+                }
+                throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);
+            }
+        } else {
+            handler.received(channel, message);
         }
     }
-
-    @Override
-    public void caught(Channel channel, Throwable exception) throws RemotingException {
-        executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.CAUGHT, exception));
-    }
-
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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