public class InvokerInvocationHandler implements InvocationHandler {<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
public class ProtocolListenerWrapper implements Protocol {<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
public abstract class AbstractInvoker implements Invoker {<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
</dubbo:reference>private final Lock lock = new ReentrantLock();<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
</dubbo:reference>throw new RemotingException(this, "message can not send, because channel is closed . url:" + getUrl());<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
public class NettyServer extends AbstractServer implements Server {<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
public class AllChannelHandler extends WrappedChannelHandler {<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
</dubbo:reference>// 如果通信方式为双向通信,此时将 Server side ... threadpool is exhausted<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
</dubbo:reference>throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
ChannelEventRunnable 依然不进行调用逻辑,只是根据通道的状态将请求转发。可以注意一下,这里特意对 RECEIVED 状态用了 if 判断,然后其它状态使用 switch 来判断,是因为绝大部分的请求都是 RECEIVED 类型。
这里的 handler 是 DecodeHandler,这是一个解码处理器。也许你会以为,这个是不是和 InternalDecoder冲突了?既然解码操作已经在 IO 线程(也就是 Netty 的 WorkerGroup)中处理了,为什么到 Dubbo 线程池中,还要再处理一次?这取决于 decode.in.io 参数,允许将部分解码工作交由 Dubbo 线程池中完成。下面我们略过 DecodeHandler,快进到 HeaderExchangeHandler 中
public class HeaderExchangeHandler implements ChannelHandlerDelegate {<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
</dubbo:reference>Response res = new Response(req.getId(), req.getVersion());<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
</dubbo:reference>// need to consider backward-compatibility if it's a callback<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
public abstract class AbstractProxyInvoker implements Invoker {<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
public class JavassistProxyFactory extends AbstractProxyFactory {<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
</dubbo:reference>throw new NoSuchMethodException(new StringBuffer().append("Not found method "").append(string).append("" in class com.alibaba.dubbo.demo.DemoService.").toString());<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">
我们直接快进到 HeaderExchangeHandler 的 received 方法中(调用路径请看 2.3.2 节末尾)
public class HeaderExchangeHandler implements ChannelHandlerDelegate {<dubbo:reference id="demoService" check="false" interface="com.alibaba.dubbo.demo.DemoService">