(Original) The provider of Dubbo source code accepts parameters

Server:

NettyHandler class:
messageReceived method:
get the message, received in the ChannelHandler class to get the message

MultiMessageHandler class:
received method:

HeartbeatHandler class:
received method:

DecodeHandler class
received method:

HeaderExchangeHandler类:
handleRequest方法:
参数:RpcInvocation
[world]
{path=com.alibaba.dubbo.demo.DemoService, input=217, dubbo=2.0.0, interface=com.alibaba.dubbo.demo.DemoService, version=0.0.0, timeout=5000000}
NettyChannel [channel=[id: 0x4c18ae45, /192.168.1.102:60779 => /192.168.1.103:20880]]
true
com.alibaba.dubbo.remoting.buffer.ChannelBufferInputStream@41e95aee
null
sayHello
[class java.lang.String]
Request [id=0, version=2.0.0, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=sayHello, parameterTypes=[class java.lang.String], arguments=[world], attachments ={path=com.alibaba.dubbo.demo.DemoService, input=217, dubbo=2.0.0, interface=com.alibaba.dubbo.demo.DemoService, version=0.0.0, timeout=5000000}]]
2
Execute The reply() of the handler variable, the handler variable is the DubboProtocol class, and executes the reply method of the ExchangeHandlerAdapter in the private variable of the DubboProtocol class.

DubboProtocol class:
Private variable: ExchangeHandler's reply method:
Convert the incoming message to Invocation, execute the getInvoker method, and convert Invocation to Invoker.

getInvoker method:
Take out the port and other parameters in nettyChanle, convert them to serviceKey, and the obtained key is com.alibaba.dubbo.demo.DemoService:20880
Take out the corresponding exporter from the server exporterMap cache, and there is a service exposed in the exporter at that time Information such as the created invorker and the address registered with the registry, and the invoker stores the entity class that the service actually executes.
Extract the invoker in the exporter. Back to private variables: the reply method of ExchangeHandler. Pass the RpcInvocation encapsulated by the request parameters to the invoker.invoke method.
Enter the invoke method in AbstractProxyInvoker through layers of fitler.

AbstractProxyInvoker class:
invoke method:
Create the execution result RpcResult object, perform the doInvoke method, execute the method of the real entity class through JavassistProxyFactory, return the result RpcResult object, and return it to the handleRequest method in the HeaderExchangeHandler class.
Return the received method, encapsulate the result as Response, and finally execute the writeRequested method of the NettyHandler class through the NettyChannel.send method

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325473759&siteId=291194637